File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -59,18 +59,22 @@ class ErrorBoundary extends Component<Props, State> {
59
59
) ;
60
60
}
61
61
62
- return children ;
62
+ return children || null ;
63
63
}
64
64
}
65
65
66
66
export const withErrorBoundary = (
67
67
Component : ComponentType < any > ,
68
68
FallbackComponent : ComponentType < any > ,
69
69
onError : Function ,
70
- ) : Function => props => (
71
- < ErrorBoundary FallbackComponent = { FallbackComponent } onError = { onError } >
72
- < Component { ...props } />
73
- </ ErrorBoundary >
74
- ) ;
70
+ ) : Function => {
71
+ const Wrapped = props => (
72
+ < ErrorBoundary FallbackComponent = { FallbackComponent } onError = { onError } >
73
+ < Component { ...props } />
74
+ </ ErrorBoundary >
75
+ ) ;
76
+ Wrapped . displayName = `WithErrorBoundary(${ getDisplayName ( Component ) } )` ;
77
+ return Wrapped ;
78
+ } ;
75
79
76
80
export default ErrorBoundary ;
You can’t perform that action at this time.
0 commit comments