Skip to content

Commit

Permalink
[APM] The Observability Getting Started page infinitely redirects, br…
Browse files Browse the repository at this point in the history
…eaking browser's back button (#95083) (#95196)

* fixing browser back button

* fixing test

Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
  • Loading branch information
kibanamachine and cauemarcondes authored Mar 23, 2021
1 parent 82b6bcc commit fd958d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { HomePage } from './';
const mockHistoryPush = jest.fn();
jest.mock('react-router-dom', () => ({
useHistory: () => ({
push: mockHistoryPush,
replace: mockHistoryPush,
}),
}));

Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/observability/public/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export function HomePage() {

useEffect(() => {
if (hasAnyData === true) {
history.push({ pathname: '/overview' });
history.replace({ pathname: '/overview' });
} else if (hasAnyData === false && isAllRequestsComplete === true) {
history.push({ pathname: '/landing' });
history.replace({ pathname: '/landing' });
}
}, [hasAnyData, isAllRequestsComplete, history]);

Expand Down

0 comments on commit fd958d5

Please sign in to comment.