-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug with Observability > APM header navigation (#100845)
Call `setHeaderActionMenu(undefined)` when the HeaderMenuPortal is unmounted. Found this line in the docs: > Calling the handler with `undefined` will unmount the current mount point. Which we weren't doing before. Previous behavior: * Go to /app/observability/alerts * Click the "View in app" button for an APM alert * Click back * Click the "View in app" button for an APM alert * Get a weird toast error message and the header menu is gone forever Now: * Go to /app/observability/alerts * Click the "View in app" button for an APM alert * Click back * Click the "View in app" button for an APM alert * Get a working header menu Fixes #97140
- Loading branch information
1 parent
50e6387
commit e17919b
Showing
3 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
x-pack/plugins/observability/public/components/shared/header_menu_portal.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import React from 'react'; | ||
import HeaderMenuPortal from './header_menu_portal'; | ||
|
||
describe('HeaderMenuPortal', () => { | ||
describe('when unmounted', () => { | ||
it('calls setHeaderActionMenu with undefined', () => { | ||
const setHeaderActionMenu = jest.fn(); | ||
|
||
const { unmount } = render( | ||
<HeaderMenuPortal setHeaderActionMenu={setHeaderActionMenu}>test</HeaderMenuPortal> | ||
); | ||
|
||
unmount(); | ||
|
||
expect(setHeaderActionMenu).toHaveBeenCalledWith(undefined); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters