Merge pull request #3204 from overleaf/msm-fix-default-error-boundary-renderer

Fixed default renderer for react error boundary

GitOrigin-RevId: 87f7d80385717db6c0222cd97ad373760c4e161c
This commit is contained in:
Chrystal Maria Griffiths 2020-09-18 12:02:34 +02:00 committed by Copybot
parent 8c739d96c6
commit f4bef24429

View file

@ -10,11 +10,15 @@ function errorHandler(error, componentStack) {
}
}
function DefaultFallbackComponent() {
return <></>
}
function withErrorBoundary(WrappedComponent, FallbackComponent) {
function ErrorBoundaryWrapper(props) {
return (
<ErrorBoundary
fallbackRender={FallbackComponent || null}
FallbackComponent={FallbackComponent || DefaultFallbackComponent}
onError={errorHandler}
>
<WrappedComponent {...props} />