frontend-plugin-api: no longer wrap component extension components in an ExtensionBoundary
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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.
|
||||
@@ -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<TProps>;
|
||||
|
||||
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<TProps>;
|
||||
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 => (
|
||||
<ExtensionBoundary node={node}>
|
||||
<ExtensionComponent {...(props as TProps)} />
|
||||
</ExtensionBoundary>
|
||||
),
|
||||
impl: ExtensionComponent,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user