Skip to content

Commit

Permalink
Fix deeplinks don't work when signing in with a new account
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberAndrii committed Oct 7, 2024
1 parent 7981265 commit 9b8a3db
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down

0 comments on commit 9b8a3db

Please sign in to comment.