From 73e65a75ffb771d5ad2da6e8078768cb0020e57b Mon Sep 17 00:00:00 2001 From: Camila Belo Date: Mon, 20 Nov 2023 09:43:07 +0100 Subject: [PATCH] refator: remove extension error pattern Signed-off-by: Camila Belo --- packages/frontend-plugin-api/api-report.md | 3 --- .../src/components/ExtensionError.tsx | 27 ------------------- .../src/components/index.ts | 2 -- .../extensions/createComponentExtension.tsx | 7 ++--- .../src/extensions/createPageExtension.tsx | 7 ++--- 5 files changed, 4 insertions(+), 42 deletions(-) delete mode 100644 packages/frontend-plugin-api/src/components/ExtensionError.tsx diff --git a/packages/frontend-plugin-api/api-report.md b/packages/frontend-plugin-api/api-report.md index fe92a9cb44..b5c63f9d22 100644 --- a/packages/frontend-plugin-api/api-report.md +++ b/packages/frontend-plugin-api/api-report.md @@ -695,9 +695,6 @@ export type ExtensionDataValues = { : never]?: TExtensionData[DataName]['T']; }; -// @public (undocumented) -export function ExtensionError(props: { error: Error }): React_2.JSX.Element; - // @public (undocumented) export interface ExtensionInput< TExtensionData extends AnyExtensionDataMap, diff --git a/packages/frontend-plugin-api/src/components/ExtensionError.tsx b/packages/frontend-plugin-api/src/components/ExtensionError.tsx deleted file mode 100644 index 5aa2ae03bd..0000000000 --- a/packages/frontend-plugin-api/src/components/ExtensionError.tsx +++ /dev/null @@ -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 ; -} diff --git a/packages/frontend-plugin-api/src/components/index.ts b/packages/frontend-plugin-api/src/components/index.ts index e0b3d09543..a7d947599f 100644 --- a/packages/frontend-plugin-api/src/components/index.ts +++ b/packages/frontend-plugin-api/src/components/index.ts @@ -16,8 +16,6 @@ export { coreComponentsRefs, type ComponentRef } from './ComponentRef'; -export { ExtensionError } from './ExtensionError'; - export { ExtensionBoundary, type ExtensionBoundaryProps, diff --git a/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx b/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx index 376510312f..e337f3f822 100644 --- a/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx +++ b/packages/frontend-plugin-api/src/extensions/createComponentExtension.tsx @@ -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: () => , - })), + .then(component => ({ default: component })), ); return { diff --git a/packages/frontend-plugin-api/src/extensions/createPageExtension.tsx b/packages/frontend-plugin-api/src/extensions/createPageExtension.tsx index d05f051a67..99733ba367 100644 --- a/packages/frontend-plugin-api/src/extensions/createPageExtension.tsx +++ b/packages/frontend-plugin-api/src/extensions/createPageExtension.tsx @@ -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: () => , - })), + .then(element => ({ default: () => element })), ); return {