From 9b8a3db6b141f25461012c49acd2f1a16fc93470 Mon Sep 17 00:00:00 2001 From: Andrii Vitiv Date: Mon, 9 Sep 2024 00:43:53 +0300 Subject: [PATCH] Fix deeplinks don't work when signing in with a new account --- src/libs/actions/Report.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index f313ecbb3f48..babf6c362148 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -2673,13 +2673,7 @@ function openReportFromDeepLink(url: string) { Session.waitForUserSignIn().then(() => { const connection = Onyx.connect({ key: ONYXKEYS.NVP_ONBOARDING, - callback: (onboarding) => { - if (onboarding) { - // Once the onboarding data is available, we want to disconnect the connection - // so it won't trigger the deeplink again every time the data is changed, for example, when relogin. - Onyx.disconnect(connection); - } - + callback: () => { Navigation.waitForProtectedRoutes().then(() => { if (route && Session.isAnonymousUser() && !Session.canAnonymousUserAccessRoute(route)) { Session.signOutAndRedirectToSignIn(true); @@ -2694,6 +2688,10 @@ function openReportFromDeepLink(url: string) { } const handleDeeplinkNavigation = () => { + // We want to disconnect the connection so it won't trigger the deeplink again + // every time the data is changed, for example, when relogin. + Onyx.disconnect(connection); + const state = navigationRef.getRootState(); const currentFocusedRoute = findFocusedRoute(state);