You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-11-30] Chat not loading after redirection from OldDot #31498
Version Number: v1.4.0-3 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): N/A Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Slack conversation:
Context
We're testing a feature to redirect users that sign up on Expensify Classic (OldDot) to New Expensify. Sometimes, upon being redirected to NewDot, the app doesn't fully load, and the chat view shows the loading animation.
Click on "Email" > enter any email address from a public domain that +classicredirect (that's what enables the redirection for now, while we test). For example: your.name+classiredirect123@gmail.com > click Next > Join
At that point you'll be redirected to NewDot, and the app should load on the Concierge chat. Sometimes, the Concierge chat doesn't get displayed
The issue doesn't always happen (maybe 1 in 10 times in my personal experience), so you might have to test multiple times in a row with different accounts.
Expected Result:
The Concierge chat should be displayed.
Actual Result:
The Concierge chat is not displayed, there's a loading animation in the chat view instead.
The problem appears to be LogOutPreviousUserPage. If the user wasn't already signed in with a different account, and the page is missing the shouldForceLogin route param, it will just display a spinner forever. Unless I'm missing something this seems like the problem?
Sign in completes and LoginWithShortLivedAuthToken page renders again, the useEffect runs, and exitTo navigation happens. Note: I think there are potentially multiple reasons this might not happen:
As soon as sign-in completes, the PublicScreens will unmount and AuthScreens will mount. I think that consistently happens before LoginWithShortLivedAuthToken re-renders, because it's further up the tree
There's nothing in the props.route that will change as a result of calling Session.signInWithShortLivedAuthToken. So even if the component re-renders, the useEffect won't
However, I think that some work to clean up and simplify this flow would be valuable. We can have only one transition page that works if a user is:
Already signed in
Signed in to the wrong account
Provided an exitTo, or not
etc...
and then we could create E2E tests for all those flows. I noticed a number of redundancies and seemingly unnecessary complexities while looking through this code.
Activity
melvin-bot commentedon Nov 17, 2023
Triggered auto assignment to @kevinksullivan (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Nov 17, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)koko57 commentedon Nov 17, 2023
I can help with this issue 🙂
danielrvidal commentedon Nov 18, 2023
@koko57 let us know how we can help diagnose! We're trying to get this one cleared asap.
roryabraham commentedon Nov 19, 2023
The problem appears to be
LogOutPreviousUserPage. If the user wasn't already signed in with a different account, and the page is missing theshouldForceLoginroute param, it will just display a spinner forever. Unless I'm missing something this seems like the problem?roryabraham commentedon Nov 19, 2023
There are two places in OldDot PHP where this redirection happens AFAICT:
And in neither case is
shouldForceLoginincluded in the URLroryabraham commentedon Nov 19, 2023
This is very consistently reproducible for me if you sign in as a new user on OldDot without being signed in to an account on NewDot
roryabraham commentedon Nov 19, 2023
Ok, I think I've figured out the race condition at play here...
"Happy" path (haven't observed yet)
PublicScreensmounts.LoginWithShortLivedAuthTokenpage renders:App/src/libs/Navigation/AppNavigator/PublicScreens.js
Lines 23 to 27 in 5d45f0f
LoginWithShortLivedAuthTokenpage renders again, theuseEffectruns, and exitTo navigation happens. Note: I think there are potentially multiple reasons this might not happen:PublicScreenswill unmount andAuthScreenswill mount. I think that consistently happens beforeLoginWithShortLivedAuthTokenre-renders, because it's further up the treeprops.routethat will change as a result of callingSession.signInWithShortLivedAuthToken. So even if the component re-renders, theuseEffectwon'tWhat actually happens 100% of the time AFAICT
PublicScreensmountsLoginWithShortLivedAuthTokenpage renders:App/src/libs/Navigation/AppNavigator/PublicScreens.js
Lines 23 to 27 in 5d45f0f
PublicScreensunmounts andAuthScreensmounts.LogOutPreviousUserPagerendersSession.signOutAndRedirectToSignIn()never happens (which, we don't want it to happen anyways...)shouldForceLoginis false.roryabraham commentedon Nov 19, 2023
Quick and dirty fix: #31522
However, I think that some work to clean up and simplify this flow would be valuable. We can have only one transition page that works if a user is:
exitTo, or notand then we could create E2E tests for all those flows. I noticed a number of redundancies and seemingly unnecessary complexities while looking through this code.
quinthar commentedon Nov 19, 2023
If this issue only happens when you're already signed in, I think this isn't a blocker
13 remaining items
melvin-bot commentedon Dec 5, 2023
@kevinksullivan, @koko57, @allroundexperts, @roryabraham Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Dec 6, 2023
@kevinksullivan, @koko57, @allroundexperts, @roryabraham Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Dec 8, 2023
@kevinksullivan, @koko57, @allroundexperts, @roryabraham Still overdue 6 days?! Let's take care of this!
roryabraham commentedon Dec 9, 2023
Friendly bump to process payment here @kevinksullivan
kevinksullivan commentedon Dec 11, 2023
Ah it's just @allroundexperts , so summarizing payment:
allroundexperts commentedon Dec 11, 2023
@kevinksullivan I think it should be $500.
kevinksullivan commentedon Dec 12, 2023
Thanks @allroundexperts , I'll let you submit the request and close this out.
JmillsExpensify commentedon Jan 24, 2024
$500 payment to @allroundexperts based on summary above.