refator: remove extension error pattern
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -695,9 +695,6 @@ export type ExtensionDataValues<TExtensionData extends AnyExtensionDataMap> = {
|
||||
: never]?: TExtensionData[DataName]['T'];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export function ExtensionError(props: { error: Error }): React_2.JSX.Element;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ExtensionInput<
|
||||
TExtensionData extends AnyExtensionDataMap,
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2023 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { useApp } from '../../../core-plugin-api/src/app/useApp';
|
||||
|
||||
/** @public */
|
||||
export function ExtensionError(props: { error: Error }) {
|
||||
const { error } = props;
|
||||
const app = useApp();
|
||||
const { BootErrorPage } = app.getComponents();
|
||||
return <BootErrorPage step="load-chunk" error={error} />;
|
||||
}
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
export { coreComponentsRefs, type ComponentRef } from './ComponentRef';
|
||||
|
||||
export { ExtensionError } from './ExtensionError';
|
||||
|
||||
export {
|
||||
ExtensionBoundary,
|
||||
type ExtensionBoundaryProps,
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
} from '../wiring';
|
||||
import { Expand } from '../types';
|
||||
import { PortableSchema } from '../schema';
|
||||
import { ExtensionError, ExtensionBoundary, ComponentRef } from '../components';
|
||||
import { ExtensionBoundary, ComponentRef } from '../components';
|
||||
|
||||
/** @public */
|
||||
export function createComponentExtension<
|
||||
@@ -54,10 +54,7 @@ export function createComponentExtension<
|
||||
const ExtensionComponent = lazy(() =>
|
||||
options
|
||||
.component({ config, inputs })
|
||||
.then(component => ({ default: component }))
|
||||
.catch(error => ({
|
||||
default: () => <ExtensionError error={error} />,
|
||||
})),
|
||||
.then(component => ({ default: component })),
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React, { lazy } from 'react';
|
||||
import { ExtensionError, ExtensionBoundary } from '../components';
|
||||
import { ExtensionBoundary } from '../components';
|
||||
import { createSchemaFromZod, PortableSchema } from '../schema';
|
||||
import {
|
||||
coreExtensionData,
|
||||
@@ -79,10 +79,7 @@ export function createPageExtension<
|
||||
const ExtensionComponent = lazy(() =>
|
||||
options
|
||||
.loader({ config, inputs })
|
||||
.then(element => ({ default: () => element }))
|
||||
.catch(error => ({
|
||||
default: () => <ExtensionError error={error} />,
|
||||
})),
|
||||
.then(element => ({ default: () => element })),
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user