From fd958d57e1d6c55c3a2eb646024af0dc19ef12ae Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 23 Mar 2021 15:04:38 -0400 Subject: [PATCH] [APM] The Observability Getting Started page infinitely redirects, breaking browser's back button (#95083) (#95196) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fixing browser back button * fixing test Co-authored-by: CauĂȘ Marcondes <55978943+cauemarcondes@users.noreply.github.com> --- x-pack/plugins/observability/public/pages/home/index.test.tsx | 2 +- x-pack/plugins/observability/public/pages/home/index.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/observability/public/pages/home/index.test.tsx b/x-pack/plugins/observability/public/pages/home/index.test.tsx index 755757ea9dc87..a2c784cb4b2de 100644 --- a/x-pack/plugins/observability/public/pages/home/index.test.tsx +++ b/x-pack/plugins/observability/public/pages/home/index.test.tsx @@ -14,7 +14,7 @@ import { HomePage } from './'; const mockHistoryPush = jest.fn(); jest.mock('react-router-dom', () => ({ useHistory: () => ({ - push: mockHistoryPush, + replace: mockHistoryPush, }), })); diff --git a/x-pack/plugins/observability/public/pages/home/index.tsx b/x-pack/plugins/observability/public/pages/home/index.tsx index e5d22fac918ad..9e7fe99e3f780 100644 --- a/x-pack/plugins/observability/public/pages/home/index.tsx +++ b/x-pack/plugins/observability/public/pages/home/index.tsx @@ -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]);