From 11fc5a34909d6de54821ec496f4d05e7c9ad779c Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 16 Aug 2020 23:16:19 +0300
Subject: feat: move ErrorBoundary inside Page root element

---
 src/containers/Page/Page.tsx | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

(limited to 'src/containers/Page/Page.tsx')

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>
   );
 };
 
-- 
cgit v1.2.3

