diff --git a/.changeset/strong-lobsters-hide.md b/.changeset/strong-lobsters-hide.md new file mode 100644 index 0000000000..7b51355eb7 --- /dev/null +++ b/.changeset/strong-lobsters-hide.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-plugin-api': patch +--- + +App component extensions are no longer wrapped in an `ExtensionBoundary`, allowing them to inherit the outer context instead. diff --git a/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx b/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx index 2efa106750..a1231d8353 100644 --- a/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx +++ b/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import React, { lazy, ComponentType } from 'react'; +import { lazy, ComponentType } from 'react'; import { AnyExtensionInputMap, ResolvedExtensionInputs, @@ -23,7 +23,7 @@ import { } from '../wiring'; import { Expand } from '../types'; import { PortableSchema } from '../schema'; -import { ExtensionBoundary, ComponentRef } from '../components'; +import { ComponentRef } from '../components'; /** @public */ export function createComponentExtension< @@ -61,28 +61,26 @@ export function createComponentExtension< output: { component: createComponentExtension.componentDataRef, }, - factory({ config, inputs, node }) { - let ExtensionComponent: ComponentType; - + factory({ config, inputs }) { if ('sync' in options.loader) { - ExtensionComponent = options.loader.sync({ config, inputs }); - } else { - const lazyLoader = options.loader.lazy; - ExtensionComponent = lazy(() => - lazyLoader({ config, inputs }).then(Component => ({ - default: Component, - })), - ) as unknown as ComponentType; + return { + component: { + ref: options.ref, + impl: options.loader.sync({ config, inputs }) as ComponentType, + }, + }; } + const lazyLoader = options.loader.lazy; + const ExtensionComponent = lazy(() => + lazyLoader({ config, inputs }).then(Component => ({ + default: Component, + })), + ) as unknown as ComponentType; return { component: { ref: options.ref, - impl: props => ( - - - - ), + impl: ExtensionComponent, }, }; },