Skip to content
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

[Due for payment 2025-03-11] [$250] [Navigation] Browser Forward Button Fails to Restore Policy Filter After Navigation #57121

Open
1 of 8 tasks
m-natarajan opened this issue Feb 19, 2025 · 14 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Feb 19, 2025

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.1.1-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @s77rt
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Open Workspace Switcher and select any policy
  2. Press browser back button
  3. Verify the policy filter is cleared
  4. Press browser forward button
  5. Verify the previous policy filter is applied

Expected Result:

User taken to Policy filter selected in step 1

Actual Result:

The home page flickers and the previous filter is not applied

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Screen.Recording.2025-02-19.at.2.15.50.PM.mov
Recording.999.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021892616298138120650
  • Upwork Job ID: 1892616298138120650
  • Last Price Increase: 2025-02-20
Issue OwnerCurrent Issue Owner: @zanyrenney
Issue OwnerCurrent Issue Owner: @WojtekBoman
@m-natarajan m-natarajan added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 19, 2025
Copy link

melvin-bot bot commented Feb 19, 2025

Triggered auto assignment to @zanyrenney (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.

@zanyrenney
Copy link
Contributor

zanyrenney commented Feb 20, 2025

@mountiny I noticed in the related issue that is linked above you said that softwaremansion and we're looking into some of these issues, just to confirm before I add the external label can this be handled by our normal bug process or should it be assigned to software mansion?

@mountiny mountiny self-assigned this Feb 20, 2025
@mountiny mountiny changed the title Browser Forward Button Fails to Restore Policy Filter After Navigation [Navigation] Browser Forward Button Fails to Restore Policy Filter After Navigation Feb 20, 2025
@mountiny
Copy link
Contributor

Thanks for the ping, I agree this will be best checked by SWM

@WojtekBoman
Copy link
Contributor

I would suggest to handle it this way:

diff --git a/src/pages/home/sidebar/BaseSidebarScreen.tsx b/src/pages/home/sidebar/BaseSidebarScreen.tsx
index 369d1f23459..2392a12d508 100644
--- a/src/pages/home/sidebar/BaseSidebarScreen.tsx
+++ b/src/pages/home/sidebar/BaseSidebarScreen.tsx
@@ -39,20 +39,17 @@ function BaseSidebarScreen() {
     }, []);
 
     useEffect(() => {
-        if (!!activeWorkspace || activeWorkspaceID === undefined || isLoading) {
-            return;
-        }
-
-        // Otherwise, if the workspace is already loaded, we don't need to do anything
-        const topmostReport = getTopmostReportsSplitNavigator();
+        const topmostReportSplit = getTopmostReportsSplitNavigator();
+        const topmostReportSplitPolicyID = topmostReportSplit?.params && `policyID` in topmostReportSplit.params ? topmostReportSplit.params.policyID : undefined;
+        const hasWorkspaceBeenDeleted = !activeWorkspace && activeWorkspaceResult.status === 'loaded' && !!topmostReportSplitPolicyID;
 
-        if (!topmostReport) {
+        if (!topmostReportSplit || !hasWorkspaceBeenDeleted || isLoading) {
             return;
         }
 
         // Switching workspace to global should only be performed from the currently opened sidebar screen
-        const topmostReportState = topmostReport?.state ?? getPreservedSplitNavigatorState(topmostReport?.key);
-        const isCurrentSidebar = topmostReportState?.routes.some((route) => currentRoute.key === route.key);
+        const topmostReportSplitState = topmostReportSplit?.state ?? getPreservedSplitNavigatorState(topmostReportSplit?.key);
+        const isCurrentSidebar = topmostReportSplitState?.routes.some((route) => currentRoute.key === route.key);
 
         if (!isCurrentSidebar) {
             return;
@@ -61,7 +58,7 @@ function BaseSidebarScreen() {
         const reportsSplitNavigatorWithoutPolicyID = getInitialSplitNavigatorState({name: SCREENS.HOME}, {name: SCREENS.REPORT});
         Navigation.replaceWithSplitNavigator(reportsSplitNavigatorWithoutPolicyID);
         updateLastAccessedWorkspace(undefined);
-    }, [activeWorkspace, activeWorkspaceID, isLoading, currentRoute.key]);
+    }, [activeWorkspace, isLoading, currentRoute.key, activeWorkspaceResult]);
 
     const shouldDisplaySearch = shouldUseNarrowLayout;

The code at the top of this hook could have been written in a better way, but I wanted to see if it works asap. I also tested how it behaves after deleting the policy and it seems to work well. When we read a policyID directly from the state, it's faster than reading it from the context. Here's a video:

Screen.Recording.2025-02-20.at.16.29.19.mov

@mountiny mountiny added the External Added to denote the issue can be worked on by a contributor label Feb 20, 2025
@melvin-bot melvin-bot bot changed the title [Navigation] Browser Forward Button Fails to Restore Policy Filter After Navigation [$250] [Navigation] Browser Forward Button Fails to Restore Policy Filter After Navigation Feb 20, 2025
Copy link

melvin-bot bot commented Feb 20, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021892616298138120650

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 20, 2025
Copy link

melvin-bot bot commented Feb 20, 2025

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

@mountiny
Copy link
Contributor

Thanks for the proposal @FitseTLT I will let SWM handle this though as they have a good context on the overall navigation structure of the app

@mountiny mountiny removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 20, 2025
@dukenv0307
Copy link
Contributor

@FitseTLT I think you should finish the pending jobs before finding the new one.

@parasharrajat
Copy link
Member

SWM

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Feb 20, 2025

Current assignee @mountiny is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@zfurtak
Copy link
Contributor

zfurtak commented Feb 21, 2025

Hello, I can take care of this one 🙋‍♀️

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Mar 4, 2025
@melvin-bot melvin-bot bot changed the title [$250] [Navigation] Browser Forward Button Fails to Restore Policy Filter After Navigation [Due for payment 2025-03-11] [$250] [Navigation] Browser Forward Button Fails to Restore Policy Filter After Navigation Mar 4, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 4, 2025
Copy link

melvin-bot bot commented Mar 4, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Mar 4, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.8-1 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-03-11. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Mar 4, 2025

@parasharrajat @zanyrenney @parasharrajat 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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants