frontend-plugin-api: remove defineParams from PluginHeaderActionBlueprint

Replace the defineParams + createExtensionBlueprintParams pattern with
inline param types on the factory, matching PageBlueprint, SubPageBlueprint,
and other blueprints. Update the app-visualizer usage accordingly.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-03-19 13:43:08 +01:00
parent 6a3e5f41c0
commit e220589506
6 changed files with 20 additions and 23 deletions
@@ -0,0 +1,5 @@
---
'@backstage/frontend-plugin-api': minor
---
**BREAKING**: Removed the `defineParams` callback from `PluginHeaderActionBlueprint`. Params are now typed inline on the factory, matching the pattern used by `PageBlueprint`, `SubPageBlueprint`, and others. To migrate, change `params: defineParams => defineParams({ ... })` to `params: { ... }` when calling `PluginHeaderActionBlueprint.make(...)`.
@@ -0,0 +1,5 @@
---
'@backstage/plugin-app-visualizer': patch
---
Updated `PluginHeaderActionBlueprint` usage to pass params as a plain object.
+2 -4
View File
@@ -1951,11 +1951,9 @@ export type PendingOAuthRequest = {
// @public
export const PluginHeaderActionBlueprint: ExtensionBlueprint_2<{
kind: 'plugin-header-action';
params: (params: {
params: {
loader: () => Promise<JSX.Element>;
}) => ExtensionBlueprintParams_2<{
loader: () => Promise<JSX.Element>;
}>;
};
output: ExtensionDataRef_2<JSX_2, 'core.reactElement', {}>;
inputs: {};
config: {};
@@ -16,11 +16,7 @@
import { lazy as reactLazy } from 'react';
import { ExtensionBoundary } from '../components';
import {
coreExtensionData,
createExtensionBlueprint,
createExtensionBlueprintParams,
} from '../wiring';
import { coreExtensionData, createExtensionBlueprint } from '../wiring';
/**
* Creates extensions that provide plugin-scoped header actions.
@@ -36,10 +32,7 @@ export const PluginHeaderActionBlueprint = createExtensionBlueprint({
kind: 'plugin-header-action',
attachTo: { id: 'api:app/plugin-header-actions', input: 'actions' },
output: [coreExtensionData.reactElement],
defineParams(params: { loader: () => Promise<JSX.Element> }) {
return createExtensionBlueprintParams(params);
},
*factory(params, { node }) {
*factory(params: { loader: () => Promise<JSX.Element> }, { node }) {
const LazyAction = reactLazy(() =>
params.loader().then(element => ({ default: () => element })),
);
+2 -5
View File
@@ -5,7 +5,6 @@
```ts
import { AnyRouteRefParams } from '@backstage/frontend-plugin-api';
import { ConfigurableExtensionDataRef } from '@backstage/frontend-plugin-api';
import { ExtensionBlueprintParams } from '@backstage/frontend-plugin-api';
import { ExtensionDataRef } from '@backstage/frontend-plugin-api';
import { ExtensionInput } from '@backstage/frontend-plugin-api';
import { IconComponent } from '@backstage/frontend-plugin-api';
@@ -124,11 +123,9 @@ const visualizerPlugin: OverridableFrontendPlugin<
configInput: {};
output: ExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>;
inputs: {};
params: (params: {
params: {
loader: () => Promise<JSX.Element>;
}) => ExtensionBlueprintParams<{
loader: () => Promise<JSX.Element>;
}>;
};
}>;
'sub-page:app-visualizer/details': OverridableExtensionDefinition<{
kind: 'sub-page';
+4 -5
View File
@@ -76,11 +76,10 @@ const appVisualizerTextPage = SubPageBlueprint.make({
});
const copyTreeAsJson = PluginHeaderActionBlueprint.make({
params: defineParams =>
defineParams({
loader: () =>
import('./components/CopyTreeButton').then(m => <m.CopyTreeButton />),
}),
params: {
loader: () =>
import('./components/CopyTreeButton').then(m => <m.CopyTreeButton />),
},
});
export const appVisualizerNavItem = NavItemBlueprint.make({