diff --git a/.changeset/three-pigs-sniff.md b/.changeset/three-pigs-sniff.md new file mode 100644 index 0000000000..c2020c9e80 --- /dev/null +++ b/.changeset/three-pigs-sniff.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-components': patch +--- + +The `ErrorPage` now falls back to using the default support configuration if the `ConfigApi` is not available. diff --git a/packages/core-components/src/hooks/useSupportConfig.ts b/packages/core-components/src/hooks/useSupportConfig.ts index 5d64e38f3d..546d779e01 100644 --- a/packages/core-components/src/hooks/useSupportConfig.ts +++ b/packages/core-components/src/hooks/useSupportConfig.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { useApi, configApiRef } from '@backstage/core-plugin-api'; +import { useApiHolder, configApiRef } from '@backstage/core-plugin-api'; export type SupportItemLink = { url: string; @@ -50,8 +50,9 @@ const DEFAULT_SUPPORT_CONFIG: SupportConfig = { }; export function useSupportConfig(): SupportConfig { - const config = useApi(configApiRef); - const supportConfig = config.getOptionalConfig('app.support'); + const apiHolder = useApiHolder(); + const config = apiHolder.get(configApiRef); + const supportConfig = config?.getOptionalConfig('app.support'); if (!supportConfig) { return DEFAULT_SUPPORT_CONFIG;