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 2025-02-04] [$250] Android - Previously selected workspace is shown briefly while navigating via workspace switcher #54554
Version Number: 9.0.78-2 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes Issue reported by: Applause Internal Team Device used: Redmi note 10s Android 13 App Component: Left Hand Navigation (LHN)
Action Performed:
Launch app
Login with account having many workspaces
Tap expensify switcher
Select a workspace
Note home page is shown briefly before showing the selected workspace page
Repeat the step 4 few times
Note everytime previously selected workspace is shown briefly before showing selected workspace page.
Expected Result:
Previously selected workspace must not be shown briefly before showing the selected workspace page while navigating to workspace using workspace switcher.
Actual Result:
Previously selected workspace is shown briefly before showing the selected workspace page while navigating to workspace using workspace switcher.
// On native platforms, we will see a blank screen if we navigate to a new HomeScreen route while navigating back at the same time.
// Therefore we delay switching the workspace until after back navigation, using the InteractionManager.
switchPolicyAfterInteractions(newPolicyID);
}
},
This will update the LHN immediately to show the selected workspace report list. However, the switchPolicyID which updates the route is delayed on native intentionally in #54030. That's why the top bar isn't updated yet because it depends on the nav route.
And because we close the switcher page, the nav state is changed and the active workspace is updated based on the current nav state, which the results will be the previous workspace, so the LHN now shows the previous workspace LHN.
After the switchPolicyID delay is done, the active workspace is set to the selected workspace, and the LHN is now updated to the selected workspace (and the top bar).
What changes do you think we should make in order to solve the problem?
We have 2 options. First, we need to put the setActiveWorkspace inside the InteractionManager too (for native).
Second, we can remove setActiveWorkspace because it'll be updated when the state is changed by switchPolicyID, but it's probably expected to call setActiveWorkspace separately so it's updated faster without waiting for the nav state update logic.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
I think we can mock the interaction manager and when selecting a workspace, we need to assert that the LHN list isn't updated before we resolve the mocked interaction manager.
// On native platforms, we will see a blank screen if we navigate to a new HomeScreen route while navigating back at the same time.
// Therefore we delay switching the workspace until after back navigation, using the InteractionManager.
switchPolicyAfterInteractions(newPolicyID);
activeWorkspaceID is set to B
That's why we can see the blink issue
Note: This issue doesn't happen on web since we're delayed switchPolicyAfterInteractions on native device only. On web, 2 actions perform at the same time so handleStateChange is triggered with up-to-date state
What changes do you think we should make in order to solve the problem?
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
changed the title [-]Android - Previously selected workspace is shown briefly while navigating via workspace switcher[/-][+][$250] Android - Previously selected workspace is shown briefly while navigating via workspace switcher[/+]on Dec 31, 2024
If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A
If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[@anmurali] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
#### Test:
1. Log in with an account that has multiple workspaces.
2. Open the workspace switcher.
3. Select workspace (A).
4. Open the workspace switcher again.
5. Select workspace (B).
6. Verify that there is no brief transition like this: workspace (B) chats > workspace (A) chats > workspace (B) chats.
7. Verify that the chats on the home page change from workspace (A) chats to workspace (B) chats (workspace (A) chats > workspace (B)).
📣 @rayane-d! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Activity
melvin-bot commentedon Dec 25, 2024
Triggered auto assignment to @anmurali (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.bernhardoj commentedon Dec 26, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
The selected workspace LHN is shown then the previous workspace and then the selected workspace again when switching workspace.
What is the root cause of that problem?
When we select a workspace, we update the active workspace context to the selected workspace.
App/src/pages/WorkspaceSwitcherPage/index.tsx
Lines 88 to 95 in 918488a
This will update the LHN immediately to show the selected workspace report list. However, the switchPolicyID which updates the route is delayed on native intentionally in #54030. That's why the top bar isn't updated yet because it depends on the nav route.
App/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx
Lines 21 to 25 in 918488a
And because we close the switcher page, the nav state is changed and the active workspace is updated based on the current nav state, which the results will be the previous workspace, so the LHN now shows the previous workspace LHN.
App/src/libs/Navigation/NavigationRoot.tsx
Lines 170 to 175 in 918488a
After the switchPolicyID delay is done, the active workspace is set to the selected workspace, and the LHN is now updated to the selected workspace (and the top bar).
What changes do you think we should make in order to solve the problem?
We have 2 options. First, we need to put the
setActiveWorkspaceinside the InteractionManager too (for native).Second, we can remove
setActiveWorkspacebecause it'll be updated when the state is changed byswitchPolicyID, but it's probably expected to callsetActiveWorkspaceseparately so it's updated faster without waiting for the nav state update logic.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
I think we can mock the interaction manager and when selecting a workspace, we need to assert that the LHN list isn't updated before we resolve the mocked interaction manager.
daledah commentedon Dec 26, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Previously selected workspace is shown briefly before showing the selected workspace page while navigating to workspace using workspace switcher.
What is the root cause of that problem?
Let's assume we're in WS
AB, activeWorkspaceID is set to BApp/src/pages/WorkspaceSwitcherPage/index.tsx
Line 88 in 918488a
App/src/pages/WorkspaceSwitcherPage/switchPolicyAfterInteractions/index.native.tsx
Lines 5 to 7 in 918488a
The active WS ID at that time is still in the stack, so it's A -> activeWorkspaceID is set to A
App/src/pages/WorkspaceSwitcherPage/index.tsx
Lines 89 to 93 in 918488a
activeWorkspaceID is set to B
That's why we can see the blink issue
Note: This issue doesn't happen on web since we're delayed switchPolicyAfterInteractions on native device only. On web, 2 actions perform at the same time so
handleStateChangeis triggered with up-to-date stateWhat changes do you think we should make in order to solve the problem?
We should move the logic
goBackto web only hereI tested this issue and tried to go back after switching to new WS on all platforms and they worked well.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)
We can remove this condition:
App/src/pages/WorkspaceSwitcherPage/index.tsx
Line 90 in 918488a
since newPolicyID is always different from activeWorkspaceID
App/src/pages/WorkspaceSwitcherPage/index.tsx
Line 86 in 918488a
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
daledah commentedon Dec 26, 2024
Note for C+: If we put the setActiveWorkspace inside the InteractionManager, we can still see the blink issue
melvin-bot commentedon Dec 31, 2024
@anmurali Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Dec 31, 2024
Job added to Upwork: https://www.upwork.com/jobs/~021874207316888194452
[-]Android - Previously selected workspace is shown briefly while navigating via workspace switcher[/-][+][$250] Android - Previously selected workspace is shown briefly while navigating via workspace switcher[/+]melvin-bot commentedon Dec 31, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-djouah (
External)40 remaining items
rayane-d commentedon Feb 3, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
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: https://github.com/Expensify/App/pull/54030/files#r1939592503
If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A
If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[@anmurali] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Do we agree 👍 or 👎
melvin-bot commentedon Feb 3, 2025
📣 @rayane-d! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
melvin-bot commentedon Feb 4, 2025
Payment Summary
Upwork Job
BugZero Checklist (@anmurali)
rayane-d commentedon Feb 4, 2025
Requested in NewDot
bernhardoj commentedon Feb 4, 2025
Requested in ND.
anmurali commentedon Feb 5, 2025
Payment Summary
melvin-bot commentedon Feb 10, 2025
@anmurali, @srikarparsi, @bernhardoj, @rayane-d Huh... This is 4 days overdue. Who can take care of this?
JmillsExpensify commentedon Feb 10, 2025
$250 approved for @bernhardoj
garrettmknight commentedon Feb 11, 2025
$250 approved for @rayane-d
melvin-bot commentedon Feb 12, 2025
@anmurali, @srikarparsi, @bernhardoj, @rayane-d 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
mallenexpensify commentedon Feb 14, 2025
Everyone is paid, test case below, thx, closing