|
1 | 1 | import React, { useReducer, useContext } from 'react' |
| 2 | +import { LS_PREFERENCES_KEY } from '../Constants' |
| 3 | +import AppStorage from '../services/localStorage' |
| 4 | +import { PreferencesProvider } from '../preferences/PreferencesContext' |
2 | 5 | import { getOSMode } from '../services/os' |
3 | 6 | import AppReducer from '../preferences/AppReducer' |
4 | | -import { PreferencesProvider } from '../preferences/PreferencesContext' |
5 | 7 | import ConfigurationContext from './ConfigurationContext' |
6 | | -import { ErrorBoundary } from 'react-error-boundary' |
7 | | -import { trackException } from '../utils/Analytics' |
8 | | -import { AiFillBug } from 'react-icons/ai' |
9 | | -import { WiRefresh } from 'react-icons/wi' |
10 | | -import { APP, LS_PREFERENCES_KEY } from '../Constants' |
11 | | -import AppStorage from '../services/localStorage' |
12 | | -import '../pages/Page.css' |
13 | | - |
14 | | -function ErrorFallback({ error, resetErrorBoundary }) { |
15 | | - return ( |
16 | | - <div className="Page appError"> |
17 | | - <AiFillBug size={64} /> |
18 | | - <p>Sorry there was a problem loading this page.</p> |
19 | | - <p>Please try again or contact the developer at {APP.contactEmail}</p> |
20 | | - <button onClick={resetErrorBoundary}> |
21 | | - <WiRefresh size={32} className={'buttonIcon'} /> Try again |
22 | | - </button> |
23 | | - </div> |
24 | | - ) |
25 | | -} |
26 | 8 |
|
27 | 9 | export default function AppWrapper({ children }) { |
28 | 10 | const configuration = useContext(ConfigurationContext) |
| 11 | + |
29 | 12 | const [state, dispatcher] = useReducer( |
30 | 13 | AppReducer, |
31 | 14 | { |
@@ -62,15 +45,9 @@ export default function AppWrapper({ children }) { |
62 | 45 | } |
63 | 46 | ) |
64 | 47 |
|
65 | | - const errorHandler = (error, info) => { |
66 | | - trackException(error, true) |
67 | | - } |
68 | | - |
69 | 48 | return ( |
70 | | - <ErrorBoundary FallbackComponent={ErrorFallback} onError={errorHandler}> |
71 | | - <PreferencesProvider value={{ ...state, dispatcher: dispatcher }}> |
72 | | - {children} |
73 | | - </PreferencesProvider> |
74 | | - </ErrorBoundary> |
| 49 | + <PreferencesProvider value={{ ...state, dispatcher: dispatcher }}> |
| 50 | + {children} |
| 51 | + </PreferencesProvider> |
75 | 52 | ) |
76 | 53 | } |
0 commit comments