diff --git a/web/src/pages/roadmap.tsx b/web/src/pages/roadmap.tsx index c21b9a0f84..63089ed8b2 100644 --- a/web/src/pages/roadmap.tsx +++ b/web/src/pages/roadmap.tsx @@ -44,7 +44,10 @@ const RoadmapPage = (props: Props): ReactElement => { useEffect(() => { if (!router.isReady) return; - if (router.query.error === "true" && userData?.profileData.hasExistingBusiness) { + if ( + (router.query.error === "true" || (router.query?.code && router.query?.state)) && + userData?.profileData.hasExistingBusiness + ) { router.replace("/dashboard"); } diff --git a/web/test/pages/index.test.tsx b/web/test/pages/index.test.tsx index d7994297db..e81d90f878 100644 --- a/web/test/pages/index.test.tsx +++ b/web/test/pages/index.test.tsx @@ -55,10 +55,10 @@ describe("HomePage", () => { expect(mockPush).toHaveBeenCalledWith("/onboarding"); }); - it("redirects to onboarding page when it is unknown if user has completed onboarding flow or not", () => { + it("redirects to roadmap page when it is unknown if user has completed onboarding flow or not", () => { setMockUserDataResponse({ error: "NO_DATA", userData: undefined }); render(withAuth(, { user: generateUser({}) })); - expect(mockPush).toHaveBeenCalledWith("/roadmap"); + expect(mockPush).toHaveBeenCalledWith("/roadmap?error=true"); }); it("opens the modal with signUp = true in the querystring", () => { useMockRouter({ isReady: true, query: { signUp: "true" } });