Merge pull request #1824 from OHIF/feat/ohif-125
OHIF-125: Error boundaries
This commit is contained in:
10 files changed
+239
-47
No files matched your search
@@ -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>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user