Merge pull request #1824 from OHIF/feat/ohif-125

OHIF-125: Error boundaries
This commit is contained in:
Danny Brown authored and GitHub committed 2020-06-26 16:47:52 -04:00
commit aa402183f4
10 files changed
+239 -47

No files matched your search

+5 -1
View File
@@ -5,6 +5,7 @@ import DataSourceWrapper from './DataSourceWrapper';
import WorkList from './WorkList';
import NotFound from './NotFound';
import buildModeRoutes from './buildModeRoutes';
import { ErrorBoundary } from '@ohif/ui';
// TODO: Make these configurable
// TODO: Include "routes" debug route if dev build
@@ -43,6 +44,7 @@ const createRoutes = (
return (
<Switch>
{allRoutes.map((route, i) => {
console.log(route);
return (
<Route
key={i}
@@ -51,7 +53,9 @@ const createRoutes = (
strict={route.strict}
render={props => (
// eslint-disable-next-line react/jsx-props-no-spreading
<route.component {...props} {...route.props} route={route} />
<ErrorBoundary context={`Route ${route.path}`} fallbackRoute="/">
<route.component {...props} {...route.props} route={route} />
</ErrorBoundary>
)}
/>
);