-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[HOLD for payment 2025-02-04] [$250] Android - Previously selected workspace is shown briefly while navigating via workspace switcher #54554
Comments
Triggered auto assignment to @anmurali ( |
ProposalPlease 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 Second, we can remove 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. |
ProposalPlease 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
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 What changes do you think we should make in order to solve the problem?We should move the logic I 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:
since newPolicyID is always different from activeWorkspaceID
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. |
Note for C+: If we put the setActiveWorkspace inside the InteractionManager, we can still see the blink issue |
@anmurali Huh... This is 4 days overdue. Who can take care of this? |
Job added to Upwork: https://www.upwork.com/jobs/~021874207316888194452 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-djouah ( |
@anmurali, @rayane-djouah Eep! 4 days overdue now. Issues have feelings too... |
@rayane-djouah What do you think about my proposal? Thanks |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@daledah I've found a bug with your suggested solution - when you select a workspace from the list, the list order change (the selected workspace move to the top) before navigating back |
@anmurali @rayane-djouah this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
@rayane-djouah Can you please share the video/screenshot? I can't reproduce your bug. |
@daledah Here are videos: Screen.Recording.2025-01-13.at.3.59.34.AM.movScreen.Recording.2025-01-13.at.3.28.14.AM.movYou can notice that the selected workspace moves to the top of the list before navigating. Maybe it is expected? |
@bernhardoj I tested your solution, but I'm still able to reproduce the blinking bug. |
@rayane-djouah may I know how you implement it? This is how I implement the 1st solution: diffthis just covers the native changes. diff --git a/src/pages/WorkspaceSwitcherPage/index.tsx b/src/pages/WorkspaceSwitcherPage/index.tsx
index 4f2d0768976..f18856082ea 100644
--- a/src/pages/WorkspaceSwitcherPage/index.tsx
+++ b/src/pages/WorkspaceSwitcherPage/index.tsx
@@ -89,12 +89,11 @@ function WorkspaceSwitcherPage() {
}
const newPolicyID = policyID === activeWorkspaceID ? undefined : policyID;
- setActiveWorkspaceID(newPolicyID);
Navigation.goBack();
if (newPolicyID !== activeWorkspaceID) {
// 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);
+ switchPolicyAfterInteractions(newPolicyID, setActiveWorkspaceID);
}
},
[activeWorkspaceID, setActiveWorkspaceID, isFocused],
diff --git a/src/pages/WorkspaceSwitcherPage/switchPolicyAfterInteractions/index.native.tsx b/src/pages/WorkspaceSwitcherPage/switchPolicyAfterInteractions/index.native.tsx
index a3df127564b..f8ca81440e4 100644
--- a/src/pages/WorkspaceSwitcherPage/switchPolicyAfterInteractions/index.native.tsx
+++ b/src/pages/WorkspaceSwitcherPage/switchPolicyAfterInteractions/index.native.tsx
@@ -1,8 +1,9 @@
import {InteractionManager} from 'react-native';
import Navigation from '@libs/Navigation/Navigation';
-function switchPolicyAfterInteractions(newPolicyID: string | undefined) {
+function switchPolicyAfterInteractions(newPolicyID: string | undefined, setActiveWorkspaceID: (policyID: string | undefined) => void) {
InteractionManager.runAfterInteractions(() => {
+ setActiveWorkspaceID(newPolicyID);
Navigation.navigateWithSwitchPolicyID({policyID: newPolicyID});
});
}
and here is how it looks: a.mp4 |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
I also think it's expected. If it's an actual issue, it should be out of scope since the target of this issue is focusing on the LHN. What do you think @rayane-djouah ? |
PR is ready cc: @rayane-djouah |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.89-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2025-02-04. 🎊 For reference, here are some details about the assignees on this issue:
|
@rayane-djouah @anmurali @rayane-djouah The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
BugZero Checklist:
Bug classificationSource of bug:
Where bug was reported:
Who reported the bug:
Regression Test Proposal
Do we agree 👍 or 👎 |
📣 @rayane-d! 📣
|
Payment Summary
BugZero Checklist (@anmurali)
|
Requested in NewDot |
Requested in ND. |
Payment Summary
|
@anmurali, @srikarparsi, @bernhardoj, @rayane-d Huh... This is 4 days overdue. Who can take care of this? |
$250 approved for @bernhardoj |
$250 approved for @rayane-d |
@anmurali, @srikarparsi, @bernhardoj, @rayane-d 6 days overdue. This is scarier than being forced to listen to Vogon poetry! |
Everyone is paid, test case below, thx, closing |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
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:
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.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6701969_1735093987379.Screenrecorder-2024-12-25-07-51-32-944_compress_1.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @anmuraliThe text was updated successfully, but these errors were encountered: