From 73750b5d13ccf062a116f804c1d78f989a2bc007 Mon Sep 17 00:00:00 2001 From: Vit Horacek <36083550+mountiny@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:59:59 +0100 Subject: [PATCH] Merge pull request #39896 from tienifr/fix/39831 [CP staging] fix Concierge chat flickers non-stop after redirecting from Old Dot (cherry picked from commit a7b8d77e1c425cc009da87025a0b056d4cbd6362) --- src/pages/LogOutPreviousUserPage.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/LogOutPreviousUserPage.tsx b/src/pages/LogOutPreviousUserPage.tsx index 37402ea8b048..c80b26bbb9e7 100644 --- a/src/pages/LogOutPreviousUserPage.tsx +++ b/src/pages/LogOutPreviousUserPage.tsx @@ -63,7 +63,15 @@ function LogOutPreviousUserPage({session, route, isAccountLoading}: LogOutPrevio const shortLivedAuthToken = route.params.shortLivedAuthToken ?? ''; SessionActions.signInWithShortLivedAuthToken(email, shortLivedAuthToken); } + // We only want to run this effect once on mount (when the page first loads after transitioning from OldDot) + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [initialURL]); + + useEffect(() => { const exitTo = route.params.exitTo as Route | null; + const sessionEmail = session?.email; + const transitionURL = NativeModules.HybridAppModule ? `${CONST.DEEPLINK_BASE_URL}${initialURL ?? ''}` : initialURL; + const isLoggingInAsNewUser = SessionUtils.isLoggingInAsNewUser(transitionURL ?? undefined, sessionEmail); // We don't want to navigate to the exitTo route when creating a new workspace from a deep link, // because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate, // which is already called when AuthScreens mounts. @@ -75,8 +83,6 @@ function LogOutPreviousUserPage({session, route, isAccountLoading}: LogOutPrevio Navigation.navigate(exitUrl); }); } - - // We only want to run this effect once on mount (when the page first loads after transitioning from OldDot) // eslint-disable-next-line react-hooks/exhaustive-deps }, [initialURL, isAccountLoading]);