-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix user is navigated to previous deeplink when re-login #47829
Fix user is navigated to previous deeplink when re-login #47829
Conversation
src/libs/actions/Report.ts
Outdated
@@ -2713,6 +2713,7 @@ function openReportFromDeepLink(url: string) { | |||
return; | |||
} | |||
|
|||
Onyx.disconnect(connectionID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bernhardoj I think we should disconnect after the navigate function. Is there any problem with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't matter whether we call it before or after. Disconnecting it won't cancel the navigation. In fact, I was thinking whether we should disconnect it earlier or not. For example, if the user is anonymous and trying to access deep link, we return early and redirect them to the sign-in modal and the connection is still there, so when the onboarding onyx data changes, the deep link logic is triggered again. I think this applies to every early return inside the logic, but I haven't tested it yet though.
App/src/libs/actions/Report.ts
Lines 2677 to 2684 in 156f0a2
Onyx.connect({ | |
key: ONYXKEYS.NVP_ONBOARDING, | |
callback: (onboarding) => { | |
Navigation.waitForProtectedRoutes().then(() => { | |
if (route && Session.isAnonymousUser() && !Session.canAnonymousUserAccessRoute(route)) { | |
Session.signOutAndRedirectToSignIn(true); | |
return; | |
} |
if (onboarding) {
Onyx.disconnect(...);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's move this to the top of the callback please and add a comment explaining why it's important to disconnect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
BUG: Infinity loading in the second login Screen.Recording.2024-08-22.at.16.09.21.mov |
@DylanDylann I just tested and it happens on Looks like it happens after #45372. We call Lines 1287 to 1289 in 156f0a2
We call App/src/pages/home/ReportScreen.tsx Lines 149 to 159 in 156f0a2
|
Ahh see, Just bring this to the original issue |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-08-26.at.15.53.51.movAndroid: mWeb ChromeScreen.Recording.2024-08-26.at.15.47.21.moviOS: NativeScreen.Recording.2024-08-26.at.15.55.00.moviOS: mWeb SafariScreen.Recording.2024-08-26.at.15.45.46.movMacOS: Chrome / SafariScreen.Recording.2024-08-26.at.15.43.51.movMacOS: DesktopScreen.Recording.2024-08-26.at.15.50.00.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, let's do one little tweak that you mentioned.
src/libs/actions/Report.ts
Outdated
@@ -2713,6 +2713,7 @@ function openReportFromDeepLink(url: string) { | |||
return; | |||
} | |||
|
|||
Onyx.disconnect(connectionID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's move this to the top of the callback please and add a comment explaining why it's important to disconnect.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.0.26-1 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.0.26-6 🚀
|
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); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're disconnecting onyx before the onboarding is complete. This caused #48475.
Details
When we do a deeplink, we connect to the onboarding onyx. When we relogin, the onyx callback is triggered which trigger the deeplink again. This PR fix it.
Fixed Issues
$ #47428
PROPOSAL: #47428 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
staging.new.expensify.com/settings
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4