Skip to content

Commit

Permalink
Merge pull request #49092 from CyberAndrii/48475-Fix-deeplinks-does-n…
Browse files Browse the repository at this point in the history
…ot-work

Fix deeplinks don't work when signing in with a new account
  • Loading branch information
puneetlath authored Oct 7, 2024
2 parents dfda14f + 9b8a3db commit ed9dac4
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 ed9dac4

Please sign in to comment.