chore: some changeset tweaks a few other changes

Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
benjdlambert
2025-08-08 12:08:23 +02:00
parent fda1bbc515
commit f4b9fd74ca
10 changed files with 52 additions and 51 deletions
@@ -7,6 +7,12 @@
- Removed: `createComponentRef`, `createComponentExtension`, `ComponentRef`, `ComponentsApi`, `componentsApiRef`, `useComponentRef`, `coreComponentRefs`
- Added: `createSwappableComponent`, `SwappableComponentBlueprint`, `SwappableComponentRef`, `SwappableComponentsApi`, `swappableComponentsApiRef`
**BREAKING**: The default `componentRefs` and exported `Core*Props` have been removed and have replacement `SwappableComponents` and revised type names instead.
- The `errorBoundaryFallback` component and `CoreErrorBoundaryFallbackProps` type have been replaced with `ErrorDisplay` swappable component and `CoreErrorDisplayProps` respectively.
- The `progress` component and `CoreProgressProps` type have been replaced with `Progress` swappable component and `ProgressProps` respectively.
- The `notFoundErrorPage` component and `CoreNotFoundErrorPageProps` type have been replaced with `NotFoundErrorPage` swappable component and `NotFoundErrorPageProps` respectively.
**Migration for creating swappable components:**
```tsx
@@ -88,5 +94,3 @@ import { Progress, NotFoundErrorPage, ErrorDisplay } from '@backstage/frontend-p
<NotFoundErrorPage />
<ErrorDisplay plugin={plugin} error={error} resetError={resetError} />
```
**BREAKING**: The `errorBoundaryFallback` component and `CoreErrorBoundaryFallbackProps` type have been replaced with `ErrorDisplay` swappable component and `CoreErrorDisplayProps` respectively.
+2 -2
View File
@@ -1,5 +1,5 @@
---
'@backstage/core-compat-api': patch
'@backstage/core-compat-api': minor
---
This is primarily an internal change that ensures legacy plugins continue to work with the new component system without requiring immediate migration.
**BREAKING**: The `componentsApi` implementation has been removed from the plugin and replaced with the new `SwappableComponentsApi` instead. Which means that the `componentsApi` is not longer backwards compatible with legacy plugins.
@@ -467,7 +467,7 @@ Superfences
superset
supertype
SVGs
Swappable
swappable
talkdesk
Talkdesk
Tanzu
@@ -24,9 +24,9 @@ import {
AnyRouteRefParams,
SwappableComponentRef,
SwappableComponentsApi,
CoreErrorDisplayProps,
CoreNotFoundErrorPageProps,
CoreProgressProps,
ErrorDisplayProps,
NotFoundErrorPageProps,
ProgressProps,
ExternalRouteRef,
IconComponent,
IconsApi,
@@ -52,13 +52,13 @@ import { type RouteResolver } from '../../../core-plugin-api/src/routing/useRout
import { convertLegacyRouteRef } from '../convertLegacyRouteRef';
class CompatComponentsApi implements SwappableComponentsApi {
readonly #Progress: ComponentType<CoreProgressProps>;
readonly #NotFoundErrorPage: ComponentType<CoreNotFoundErrorPageProps>;
readonly #ErrorBoundaryFallback: ComponentType<CoreErrorDisplayProps>;
readonly #Progress: ComponentType<ProgressProps>;
readonly #NotFoundErrorPage: ComponentType<NotFoundErrorPageProps>;
readonly #ErrorBoundaryFallback: ComponentType<ErrorDisplayProps>;
constructor(app: AppContext) {
const components = app.getComponents();
const ErrorBoundaryFallback = (props: CoreErrorDisplayProps) => (
const ErrorBoundaryFallback = (props: ErrorDisplayProps) => (
<components.ErrorBoundaryFallback
{...props}
plugin={props.plugin && toLegacyPlugin(props.plugin)}
@@ -18,7 +18,7 @@ import { ComponentType } from 'react';
import {
SwappableComponentBlueprint,
ApiBlueprint,
CoreErrorDisplayProps,
ErrorDisplayProps,
createExtension,
createFrontendModule,
ExtensionDefinition,
@@ -179,7 +179,7 @@ export function convertLegacyAppOptions(
}
if (ErrorBoundaryFallback) {
const WrappedErrorBoundaryFallback = (props: CoreErrorDisplayProps) =>
const WrappedErrorBoundaryFallback = (props: ErrorDisplayProps) =>
compatWrapper(
<ErrorBoundaryFallback
{...props}
@@ -24,7 +24,7 @@ import { OpaqueSwappableComponentRef } from '@internal/frontend';
import { lazy } from 'react';
/**
* Implementation for the {@linkComponentApi}
* Implementation for the {@link SwappableComponentsApi}
*
* @internal
*/
+21 -24
View File
@@ -374,13 +374,6 @@ export interface ConfigurableExtensionDataRef<
>;
}
// @public (undocumented)
export type CoreErrorDisplayProps = {
plugin?: FrontendPlugin;
error: Error;
resetError: () => void;
};
// @public (undocumented)
export const coreExtensionData: {
reactElement: ConfigurableExtensionDataRef<
@@ -396,14 +389,6 @@ export const coreExtensionData: {
>;
};
// @public (undocumented)
export type CoreNotFoundErrorPageProps = {
children?: ReactNode;
};
// @public (undocumented)
export type CoreProgressProps = {};
export { createApiFactory };
export { createApiRef };
@@ -872,9 +857,16 @@ export { errorApiRef };
// @public (undocumented)
export const ErrorDisplay: ((
props: CoreErrorDisplayProps,
props: ErrorDisplayProps,
) => JSX.Element | null) & {
ref: SwappableComponentRef<CoreErrorDisplayProps, CoreErrorDisplayProps>;
ref: SwappableComponentRef<ErrorDisplayProps, ErrorDisplayProps>;
};
// @public (undocumented)
export type ErrorDisplayProps = {
plugin?: FrontendPlugin;
error: Error;
resetError: () => void;
};
// @public (undocumented)
@@ -1534,12 +1526,14 @@ export const NavItemBlueprint: ExtensionBlueprint<{
// @public (undocumented)
export const NotFoundErrorPage: ((
props: CoreNotFoundErrorPageProps,
props: NotFoundErrorPageProps,
) => JSX.Element | null) & {
ref: SwappableComponentRef<
CoreNotFoundErrorPageProps,
CoreNotFoundErrorPageProps
>;
ref: SwappableComponentRef<NotFoundErrorPageProps, NotFoundErrorPageProps>;
};
// @public (undocumented)
export type NotFoundErrorPageProps = {
children?: ReactNode;
};
export { OAuthApi };
@@ -1627,10 +1621,13 @@ export { ProfileInfo };
export { ProfileInfoApi };
// @public (undocumented)
export const Progress: ((props: CoreProgressProps) => JSX.Element | null) & {
ref: SwappableComponentRef<CoreProgressProps, CoreProgressProps>;
export const Progress: ((props: ProgressProps) => JSX.Element | null) & {
ref: SwappableComponentRef<ProgressProps, ProgressProps>;
};
// @public (undocumented)
export type ProgressProps = {};
// @public
export type ResolvedExtensionInput<
TExtensionInput extends ExtensionInput<any, any>,
@@ -15,16 +15,16 @@
*/
import {
CoreErrorDisplayProps,
CoreNotFoundErrorPageProps,
CoreProgressProps,
ErrorDisplayProps,
NotFoundErrorPageProps,
ProgressProps,
} from '../types';
import { createSwappableComponent } from './createSwappableComponent';
/**
* @public
*/
export const Progress = createSwappableComponent<CoreProgressProps>({
export const Progress = createSwappableComponent<ProgressProps>({
id: 'core.components.progress',
});
@@ -32,14 +32,14 @@ export const Progress = createSwappableComponent<CoreProgressProps>({
* @public
*/
export const NotFoundErrorPage =
createSwappableComponent<CoreNotFoundErrorPageProps>({
createSwappableComponent<NotFoundErrorPageProps>({
id: 'core.components.notFoundErrorPage',
});
/**
* @public
*/
export const ErrorDisplay = createSwappableComponent<CoreErrorDisplayProps>({
export const ErrorDisplay = createSwappableComponent<ErrorDisplayProps>({
id: 'core.components.errorDisplay',
loader: () => props =>
<div data-testid="core.components.errorDisplay">{props.error.message}</div>,
+3 -3
View File
@@ -32,7 +32,7 @@ export * from './translation';
export * from './wiring';
export type {
CoreProgressProps,
CoreNotFoundErrorPageProps,
CoreErrorDisplayProps,
ProgressProps,
NotFoundErrorPageProps,
ErrorDisplayProps,
} from './types';
+3 -3
View File
@@ -18,15 +18,15 @@ import { ReactNode } from 'react';
import { FrontendPlugin } from './wiring';
/** @public */
export type CoreProgressProps = {};
export type ProgressProps = {};
/** @public */
export type CoreNotFoundErrorPageProps = {
export type NotFoundErrorPageProps = {
children?: ReactNode;
};
/** @public */
export type CoreErrorDisplayProps = {
export type ErrorDisplayProps = {
plugin?: FrontendPlugin;
error: Error;
resetError: () => void;