aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-08-16 23:16:19 +0300
committereug-vs <eug-vs@keemail.me>2020-08-16 23:16:19 +0300
commit11fc5a34909d6de54821ec496f4d05e7c9ad779c (patch)
treec33cc755ac3b4912f7da5f51e5888b867f727be9
parent7f1a4ebde3ec32a703f04c989b4802b800f65c57 (diff)
downloadwhich-ui-11fc5a34909d6de54821ec496f4d05e7c9ad779c.tar.gz
feat: move ErrorBoundary inside Page root element
-rw-r--r--src/containers/Page/Page.tsx30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/containers/Page/Page.tsx b/src/containers/Page/Page.tsx
index a1d6456..4aa48eb 100644
--- a/src/containers/Page/Page.tsx
+++ b/src/containers/Page/Page.tsx
@@ -22,6 +22,10 @@ const useStyles = makeStyles(theme => ({
}
}));
+const ErrorFallback: React.FC = () => (
+ <EmptyState variant="error" message="Try reloading the page." />
+);
+
const Page: React.FC = () => {
const classes = useStyles();
const theme = useTheme();
@@ -35,26 +39,24 @@ const Page: React.FC = () => {
}, [history]);
return (
- <ErrorBoundary
- FallbackComponent={() => <EmptyState variant="error" message="Try reloading the page." />}
+ <SnackbarProvider
+ preventDuplicate
+ maxSnack={isMobile ? 1 : 3}
+ anchorOrigin={{
+ vertical: 'top',
+ horizontal: 'right'
+ }}
>
- <SnackbarProvider
- preventDuplicate
- maxSnack={isMobile ? 1 : 3}
- anchorOrigin={{
- vertical: 'top',
- horizontal: 'right'
- }}
- >
- <div className={classes.root}>
+ <div className={classes.root}>
+ <ErrorBoundary FallbackComponent={ErrorFallback}>
<Suspense fallback={<Loading />}>
<DynoWaiter>
<Router />
</DynoWaiter>
</Suspense>
- </div>
- </SnackbarProvider>
- </ErrorBoundary>
+ </ErrorBoundary>
+ </div>
+ </SnackbarProvider>
);
};