aboutsummaryrefslogtreecommitdiff
path: root/src/containers/Page/Page.tsx
diff options
context:
space:
mode:
authorEugene Sokolov <eug-vs@keemail.me>2020-08-16 00:25:25 +0300
committerGitHub <noreply@github.com>2020-08-16 00:25:25 +0300
commit1db77b9cc96ee8f7c014f383ae71da0d225a6d6a (patch)
tree26dd3bc254d4cbe2a53fa12fac97814041565073 /src/containers/Page/Page.tsx
parent694918dcf0565e14dc4cba69e89907be9bed1544 (diff)
parent6f82250c15d26b8bfaaff07cda9f6b05c53ef2c4 (diff)
downloadwhich-ui-1db77b9cc96ee8f7c014f383ae71da0d225a6d6a.tar.gz
Merge pull request #85 from which-ecosystem/errors
Handle frontend errors
Diffstat (limited to 'src/containers/Page/Page.tsx')
-rw-r--r--src/containers/Page/Page.tsx36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/containers/Page/Page.tsx b/src/containers/Page/Page.tsx
index 475f76d..a1d6456 100644
--- a/src/containers/Page/Page.tsx
+++ b/src/containers/Page/Page.tsx
@@ -2,11 +2,13 @@ import React, { Suspense, useEffect } from 'react';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import { useMediaQuery } from '@material-ui/core';
import { SnackbarProvider } from 'notistack';
+import { ErrorBoundary } from 'react-error-boundary';
import { useHistory } from 'react-router-dom';
import Router from './Router';
import DynoWaiter from './DynoWaiter';
import Loading from '../../components/Loading/Loading';
+import EmptyState from '../../components/EmptyState/EmptyState';
const useStyles = makeStyles(theme => ({
@@ -33,22 +35,26 @@ const Page: React.FC = () => {
}, [history]);
return (
- <SnackbarProvider
- preventDuplicate
- maxSnack={isMobile ? 1 : 3}
- anchorOrigin={{
- vertical: 'top',
- horizontal: 'right'
- }}
+ <ErrorBoundary
+ FallbackComponent={() => <EmptyState variant="error" message="Try reloading the page." />}
>
- <div className={classes.root}>
- <Suspense fallback={<Loading />}>
- <DynoWaiter>
- <Router />
- </DynoWaiter>
- </Suspense>
- </div>
- </SnackbarProvider>
+ <SnackbarProvider
+ preventDuplicate
+ maxSnack={isMobile ? 1 : 3}
+ anchorOrigin={{
+ vertical: 'top',
+ horizontal: 'right'
+ }}
+ >
+ <div className={classes.root}>
+ <Suspense fallback={<Loading />}>
+ <DynoWaiter>
+ <Router />
+ </DynoWaiter>
+ </Suspense>
+ </div>
+ </SnackbarProvider>
+ </ErrorBoundary>
);
};