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-12-28] [$500] Workspace - Currencies do not load after transition from OldDot when other user logged in ND #31789
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: 1.4.3-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:
Action Performed:
Navigate to OldDot Expensify and log in with an existing account which has a workspace
Open new tab > navigate to NewDot Expensify and log in with different account
In the OldDot tab, navigate to the workspace and click on it
Click on Settings > Default currency
Expected Result:
A list of all available currencies should be shown
Actual Result:
The list is empty, even the default currency is not shown
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-]Workspace - Currencies do not load after transition from OldDot when other user logged in ND[/-][+][$500] Workspace - Currencies do not load after transition from OldDot when other user logged in ND[/+]on Nov 23, 2023
Please re-state the problem that we are trying to solve in this issue.
Currency list is not loaded when transitioning from OldDot to NewDot with different account.
What is the root cause of that problem?
Currency list is loaded by openApp() method. In AuthScreens, when transitioning, this method will be called if app is logging as a new user (different user):
In this state, user has logged in with the email from the transition, i.e. email from the URL params is the same as the session email, thus the app is treating it as a login from the same email.
What changes do you think we should make in order to solve the problem?
There needs to be a way of storing the previous session's email so that it can be compared accurately with the email from the new session.
Add new property in the Session store:
/** The user's email of the previous session */previousSessionEmail?: string;
Create new utility to store the previous session email:
So in this code we are returning false if session?.authToken, and since we are deeplinking to the workspace settings from OD we would be using Session.signInWithShortLivedAuthToken which means session?.authToken will be indeed populated resulting in AuthScreens to call App.reconnectApp instead of App.openApp resulting in the onyx store not getting populated properly which is the reason that as you will see in the screenshot below, the LHN would be not populated either:
What changes do you think we should make in order to solve the problem?
We can do the following:
We would add a new entry to Session.ts to watch for if the login was with short lived token
signedInWithShortLivedAuthToken?: boolean;
We would then add a temporary onyx merge in signInWithShortLivedAuthToken within the optimisticData but remove it in successData to allow App.openApp to be called at least once when using short lived token
The PR that introduced the bug has been identified. Link to the PR:
N/A (This is an interaction between OldDot and NewDot, both sides would need to be analyzed to point to specific PRs with certainty, while the OldDot code is not available)
The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
N/A
A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
No need for additional discussion
Determine if we should create a regression test for this bug.
Up to the QA team
If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Sign in to OldDot using account A
Sign in to NewDot using a different account B
Use the same environment (staging or prod) you used for OldDot
From OldDot, go to Settings > Workspaces and click on a workspace
Once the NewDot app loads, go to (Your workspace) > Settings > Default currency and verify that the currency list is populated
This was caught by Applause during testing, so I think it's already captured under existing regression testing. I think it's likely we don't need a new test as a result, but if anyone disagrees, comment and let me know!
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
[-]Workspace - Currencies do not load after transition from OldDot when other user logged in ND[/-][+][$500] Workspace - Currencies do not load after transition from OldDot when other user logged in ND[/+]melvin-bot commentedon Nov 23, 2023
Job added to Upwork: https://www.upwork.com/jobs/~019bf54ae70b3509e1
melvin-bot commentedon Nov 23, 2023
Triggered auto assignment to @conorpendergrast (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Nov 23, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Nov 23, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @cubuspl42 (
External)zukilover commentedon Nov 24, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Currency list is not loaded when transitioning from OldDot to NewDot with different account.
What is the root cause of that problem?
Currency list is loaded by
openApp()method. InAuthScreens, when transitioning, this method will be called if app is logging as a new user (different user):App/src/libs/Navigation/AppNavigator/AuthScreens.js
Lines 160 to 161 in a2fc32b
The problem is, upon transitioning to a new user, app is logging out:
App/src/libs/Navigation/AppNavigator/AuthScreens.js
Lines 164 to 167 in a2fc32b
then redirected to
LogInWithShortLivedAuthTokenPageto initiatesignInWithShortLivedAuthToken:App/src/pages/LogInWithShortLivedAuthTokenPage.js
Lines 60 to 63 in a2fc32b
In this state, user has logged in with the email from the transition, i.e. email from the URL params is the same as the session email, thus the app is treating it as a login from the same email.
What changes do you think we should make in order to solve the problem?
There needs to be a way of storing the previous session's email so that it can be compared accurately with the email from the new session.
Sessionstore:LogInWithShortLivedAuthTokenPage, we store the email before logging in with the new one:AuthScreen:What alternative solutions did you explore? (Optional)
N/A
conorpendergrast commentedon Nov 24, 2023
Reproduced. Seems like it could be relatively rare in the real world, but we have plenty of customers with multiple user accounts!
AmjedNazzal commentedon Nov 24, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workspace - Currencies do not load after transition from OldDot when other user logged in ND
What is the root cause of that problem?
The cause of this issue starts in this code:
App/src/libs/SessionUtils.ts
Lines 32 to 45 in a2fc32b
So in this code we are returning
falseifsession?.authToken, and since we are deeplinking to the workspace settings from OD we would be usingSession.signInWithShortLivedAuthTokenwhich meanssession?.authTokenwill be indeed populated resulting inAuthScreensto callApp.reconnectAppinstead ofApp.openAppresulting in the onyx store not getting populated properly which is the reason that as you will see in the screenshot below, the LHN would be not populated either:What changes do you think we should make in order to solve the problem?
We can do the following:
signInWithShortLivedAuthTokenwithin theoptimisticDatabut remove it insuccessDatato allowApp.openAppto be called at least once when using short lived tokenSessionUtils.isLoggingInAsNewUserwe would check this new session value and if it's true we return true forloggedInDuringSessionResult
Screen.Recording.2023-11-24.at.12.41.21.PM.mov
38 remaining items
melvin-bot commentedon Jan 4, 2024
Triggered auto assignment to @sophiepintoraetz (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.thienlnam commentedon Jan 4, 2024
Adding another BZ member that can issue payment while Connor is OOO - cc @sophiepintoraetz Looks like this is ready for payment
sophiepintoraetz commentedon Jan 4, 2024
We did say that payments might be a little slower with the holidays but in any case, I have paid @AmjedNazzal - just waiting on @cubuspl42 to complete the checklist.
jakub-trzebiatowski commentedon Jan 5, 2024
melvin-bot commentedon Jan 8, 2024
@francoisl, @cubuspl42, @conorpendergrast, @sophiepintoraetz, @AmjedNazzal Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
conorpendergrast commentedon Jan 8, 2024
This was caught by Applause during testing, so I think it's already captured under existing regression testing. I think it's likely we don't need a new test as a result, but if anyone disagrees, comment and let me know!
Apart from that, we're all done here. Thanks!