Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Add EuiErrorBoundary to catch errors in the functionals #117976

Merged
merged 5 commits into from
Nov 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions src/plugins/discover/public/application/discover_router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { Redirect, Route, Router, Switch } from 'react-router-dom';
import React from 'react';
import { History } from 'history';
import { EuiErrorBoundary } from '@elastic/eui';
import { KibanaContextProvider } from '../../../kibana_react/public';
import { ContextAppRoute } from './context';
import { SingleDocRoute } from './doc';
Expand All @@ -25,29 +26,31 @@ export const discoverRouter = (services: DiscoverServices, history: History) =>

return (
<KibanaContextProvider services={services}>
<Router history={history} data-test-subj="discover-react-router">
<Switch>
<Route
path="/context/:indexPatternId/:id"
children={<ContextAppRoute services={services} />}
/>
<Route
path="/doc/:indexPattern/:index/:type"
render={(props) => (
<Redirect
to={`/doc/${props.match.params.indexPattern}/${props.match.params.index}`}
/>
)}
/>
<Route
path="/doc/:indexPatternId/:index"
children={<SingleDocRoute services={services} />}
/>
<Route path="/view/:id" children={<DiscoverMainRoute {...mainRouteProps} />} />
<Route path="/" exact children={<DiscoverMainRoute {...mainRouteProps} />} />
<NotFoundRoute services={services} />
</Switch>
</Router>
<EuiErrorBoundary>
<Router history={history} data-test-subj="discover-react-router">
<Switch>
<Route
path="/context/:indexPatternId/:id"
children={<ContextAppRoute services={services} />}
/>
<Route
path="/doc/:indexPattern/:index/:type"
render={(props) => (
<Redirect
to={`/doc/${props.match.params.indexPattern}/${props.match.params.index}`}
/>
)}
/>
<Route
path="/doc/:indexPatternId/:index"
children={<SingleDocRoute services={services} />}
/>
<Route path="/view/:id" children={<DiscoverMainRoute {...mainRouteProps} />} />
<Route path="/" exact children={<DiscoverMainRoute {...mainRouteProps} />} />
<NotFoundRoute services={services} />
</Switch>
</Router>
</EuiErrorBoundary>
</KibanaContextProvider>
);
};