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:
Adam Kunicki
2025-10-26 19:25:02 -07:00
parent 66f29d2921
commit aeae90c969
4 changed files with 77 additions and 23 deletions
+3 -2
View File
@@ -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>
));