1- import { Component , ComponentType , ErrorInfo , PropsWithChildren , ReactNode , useContext , useMemo } from 'react' ;
1+ import {
2+ Component ,
3+ ComponentType ,
4+ ErrorInfo ,
5+ PropsWithChildren ,
6+ ReactNode ,
7+ useContext ,
8+ useMemo ,
9+ } from 'react' ;
210
311import { ErrorPanel } from '@backstage/core-components' ;
412
@@ -21,21 +29,21 @@ class ErrorBoundary extends Component<
2129 }
2230
2331 componentDidCatch ( error : Error , errorInfo : ErrorInfo ) {
24- const { Component } = this . props ;
25- const name = Component . displayName ?? Component . name ?? 'Component' ;
32+ const { Component : Comp } = this . props ;
33+ const name = Comp . displayName ?? Comp . name ?? 'Component' ;
2634 // eslint-disable-next-line no-console
2735 console . error ( `Error in application/provider ${ name } : ${ error . message } ` , {
2836 error,
2937 errorInfo,
30- Component,
38+ Component : Comp ,
3139 } ) ;
3240 }
3341
3442 render ( ) {
35- const { Component, children } = this . props ;
43+ const { Component : Comp , children } = this . props ;
3644 const { error } = this . state ;
3745 if ( error ) {
38- const name = Component . displayName ?? Component . name ?? 'Component' ;
46+ const name = Comp . displayName ?? Comp . name ?? 'Component' ;
3947 const title = `Error in application/provider ${ name } : ${ error . message } ` ;
4048 return (
4149 < >
@@ -44,13 +52,11 @@ class ErrorBoundary extends Component<
4452 </ >
4553 ) ;
4654 }
47- return < Component > { children } </ Component > ;
55+ return < Comp > { children } </ Comp > ;
4856 }
4957}
5058
51- export const ApplicationProvider = ( {
52- children,
53- } : PropsWithChildren < { } > ) => {
59+ export const ApplicationProvider = ( { children } : PropsWithChildren < { } > ) => {
5460 const { mountPoints } = useContext ( DynamicRootContext ) ;
5561 const providers = useMemo (
5662 ( ) => mountPoints [ 'application/provider' ] ?? [ ] ,
@@ -59,12 +65,12 @@ export const ApplicationProvider = ({
5965 if ( providers . length === 0 ) {
6066 return children ;
6167 }
62- return providers . reduceRight ( ( acc , { Component } , index ) => {
68+ return providers . reduceRight ( ( acc , { Component : Comp } , index ) => {
6369 return (
6470 < ErrorBoundary
6571 // eslint-disable-next-line react/no-array-index-key
6672 key = { index }
67- Component = { Component }
73+ Component = { Comp }
6874 >
6975 { acc }
7076 </ ErrorBoundary >
0 commit comments