refactor(home): bundle widget data into single extension ref
Following FormFieldBlueprint pattern, bundle component and metadata into a single comprehensive homePageWidgetDataRef instead of outputting them separately. This addresses review feedback about outputting data that nothing consumes. - Create homePageWidgetDataRef in plugin-home-react - Update HomepageWidgetBlueprint to output bundled data - Update HomepageBlueprint to consume bundled data and extract component - Remove unused widgetMetadataRef export Signed-off-by: Adam Kunicki <kunickiaj@gmail.com>
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
import { Fragment, type ReactElement, type ReactNode } from 'react';
|
||||
import { CustomHomepageGrid } from '../components';
|
||||
import type { CustomHomepageGridProps } from '../components';
|
||||
import { homePageWidgetDataRef } from '@backstage/plugin-home-react/alpha';
|
||||
|
||||
/**
|
||||
* Arguments provided to the homepage renderer.
|
||||
@@ -78,13 +79,13 @@ export const HomepageBlueprint = createExtensionBlueprint({
|
||||
attachTo: DEFAULT_ATTACH_POINT,
|
||||
output: [coreExtensionData.reactElement, coreExtensionData.title.optional()],
|
||||
inputs: {
|
||||
widgets: createExtensionInput([coreExtensionData.reactElement]),
|
||||
widgets: createExtensionInput([homePageWidgetDataRef]),
|
||||
},
|
||||
*factory(params: HomepageBlueprintParams = {}, { inputs, node }) {
|
||||
const widgetOutputs = inputs.widgets ?? [];
|
||||
const widgetElements = widgetOutputs.map((widget, index) => (
|
||||
<Fragment key={index}>
|
||||
{widget.get(coreExtensionData.reactElement)}
|
||||
{widget.get(homePageWidgetDataRef).component}
|
||||
</Fragment>
|
||||
));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user