[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:
parent
b2433cdcd9
commit
134959d224
|
@ -14,7 +14,7 @@ import { HomePage } from './';
|
|||
const mockHistoryPush = jest.fn();
|
||||
jest.mock('react-router-dom', () => ({
|
||||
useHistory: () => ({
|
||||
push: mockHistoryPush,
|
||||
replace: mockHistoryPush,
|
||||
}),
|
||||
}));
|
||||
|
||||
|
|
|
@ -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]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue