[APM] The Observability Getting Started page infinitely redirects, breaking browser's back button (#95083)

* fixing browser back button

* fixing test
This commit is contained in:
Cauê Marcondes 2021-03-23 12:42:36 -04:00 committed by GitHub
parent b2433cdcd9
commit 134959d224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -14,7 +14,7 @@ import { HomePage } from './';
const mockHistoryPush = jest.fn();
jest.mock('react-router-dom', () => ({
useHistory: () => ({
push: mockHistoryPush,
replace: mockHistoryPush,
}),
}));

View file

@ -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]);