Skip to content

Commit

Permalink
Merge pull request Expensify#47829 from bernhardoj/fix/47428-user-nav…
Browse files Browse the repository at this point in the history
…igated-to-deeplink-when-relogin

Fix user is navigated to previous deeplink when re-login
  • Loading branch information
neil-marcellini authored Aug 27, 2024
2 parents c9e53f6 + a32c06b commit 1d72155
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2668,9 +2668,15 @@ function openReportFromDeepLink(url: string) {
// Navigate to the report after sign-in/sign-up.
InteractionManager.runAfterInteractions(() => {
Session.waitForUserSignIn().then(() => {
Onyx.connect({
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);
}

Navigation.waitForProtectedRoutes().then(() => {
if (route && Session.isAnonymousUser() && !Session.canAnonymousUserAccessRoute(route)) {
Session.signOutAndRedirectToSignIn(true);
Expand Down

0 comments on commit 1d72155

Please sign in to comment.