Skip to content

Commit

Permalink
[APM] Fix side navigation breaks in APM on 404 page (#151497)
Browse files Browse the repository at this point in the history
https://user-images.githubusercontent.com/55978943/219460483-f7cf498e-f6f1-472c-bd86-cdd832b47a97.mov

Adds a `key` property with the current location, so when the URL is
changed it invalidates the ErrorBoundary component.
  • Loading branch information
cauemarcondes committed Feb 16, 2023
1 parent ccd78c9 commit 31797f5
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ import { EuiErrorBoundary } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import React from 'react';
import { NotFoundPrompt } from '@kbn/shared-ux-prompt-not-found';
import { useLocation } from 'react-router-dom';
import { ApmPluginStartDeps } from '../../plugin';

export class ApmErrorBoundary extends React.Component<
export function ApmErrorBoundary({ children }: { children?: React.ReactNode }) {
const location = useLocation();
return <ErrorBoundary key={location.pathname}>{children}</ErrorBoundary>;
}

class ErrorBoundary extends React.Component<
{ children?: React.ReactNode },
{ error?: Error },
{}
Expand Down

0 comments on commit 31797f5

Please sign in to comment.