Skip to content

[$250] Android - Inbox - WS filters are not reset to "All Chats" when deleting actual workspace. #53879

Closed

Description

@IuliiaHerets

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.73-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: 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): ibellicotest+86@gmail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Open the Expensify app.
  2. Tap on the workspace switcher on the top left corner.
  3. Select any workspace.
  4. Tap on "Settings" and select "Workspaces"
  5. Tap on the three dots icon on the selected workspace.
  6. Delete the workspace.
  7. Return to inbox using the device back button.
  8. Verify that inbox section is not filtered by the selected workspace anymore and all the chats are displayed.

Expected Result:

When deleting the actual workspace, inbox section should return to "All Chats" mode again.

Actual Result:

After deleting actual workspace and returning to inbox using device back button, chats are still filtered by workspace and are not reseted to "All Chats" mode.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6690201_1733850647051.WS_Filters.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021869052011810427221
  • Upwork Job ID: 1869052011810427221
  • Last Price Increase: 2025-01-07
Issue OwnerCurrent Issue Owner: @abdulrahuman5196

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 10, 2024
  2. melvin-bot commented on Dec 10, 2024

    @melvin-bot

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

  3. bernhardoj commented on Dec 11, 2024

    @bernhardoj
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The home LHN doesn't reset to All chats when deleting the selected workspace from workspace switcher page.

    What is the root cause of that problem?

    When we delete the workspace, it will call switchPolicyID which pushes a new bottom tab screen, in this case, the Settings, with the policyID param removed.

    if (name === SCREENS.SEARCH.CENTRAL_PANE) {
    name = SCREENS.SEARCH.BOTTOM_TAB;
    } else if (!params) {
    params = {policyID};
    } else {
    params.policyID = policyID;
    }
    // If the last route in the BottomTabNavigator is already a 'Home' route, we want to change the params rather than pushing a new 'Home' route,
    // so that the screen does not get re-mounted. This would cause an empty screen/white flash when navigating back from the workspace switcher.
    const homeRoute = bottomTabNavigatorRoute.state.routes.at(-1);
    if (homeRoute && homeRoute.name === SCREENS.HOME) {
    return {
    ...CommonActions.setParams(params),
    source: homeRoute?.key,
    };
    }
    // If there is no 'Home' route in the BottomTabNavigator or if we are updating a different navigator, we want to push a new route.
    return {
    type: CONST.NAVIGATION.ACTION_TYPE.PUSH,
    payload: {
    name,
    params,
    },
    target: bottomTabNavigatorRoute.state.key,
    };

    [Home, Home (policyA), Settings (policyA)] -> [Home, Home (policyA), Settings (policyA), Settings]

    So, the LHN (Home) with the filtered workspace is still in the stack. Also, that's why we need to go back twice from settings, but it's a different issue to discuss. When we go back, we simply pop the screen until we arrive at the LHN with the filtered workspace.

    We already have a solution to handle this case, which was added by this PR: #45285, that is by removing the policyID from the LHN (home) when the workspace is missing.

    useEffect(() => {
    // Whether the active workspace or the "Everything" page is loaded
    const isWorkspaceOrEverythingLoaded = !!activeWorkspace || activeWorkspaceID === undefined;
    // If we are currently switching workspaces, we don't want to do anything until the target workspace is loaded
    if (isSwitchingWorkspace.current) {
    if (isWorkspaceOrEverythingLoaded) {
    isSwitchingWorkspace.current = false;
    }
    return;
    }
    // Otherwise, if the workspace is already loaded, we don't need to do anything
    if (isWorkspaceOrEverythingLoaded) {
    return;
    }
    isSwitchingWorkspace.current = true;
    Navigation.navigateWithSwitchPolicyID({policyID: undefined});
    updateLastAccessedWorkspace(undefined);
    }, [activeWorkspace, activeWorkspaceID]);

    The problem is, after deleting the workspace, the workspace data still exists on the onyx with this information that is returned by the BE.
    image

    What changes do you think we should make in order to solve the problem?

    To fix it, we can check for the workspace/policy type.

    const isWorkspaceOrEverythingLoaded = !!activeWorkspace || activeWorkspaceID === undefined;

    const isWorkspaceOrEverythingLoaded = !!activeWorkspace?.type || activeWorkspaceID === undefined;
    

    or use shouldShowPolicy

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

  4. melvin-bot commented on Dec 16, 2024

    @melvin-bot

    @abekkala Huh... This is 4 days overdue. Who can take care of this?

  5. changed the title [-]Android - Inbox - WS filters are not reseted to "All Chats" when deleting actual workspace.[/-] [+]Android - Inbox - WS filters are not reset to "All Chats" when deleting actual workspace.[/+] on Dec 17, 2024
  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Dec 17, 2024
  7. changed the title [-]Android - Inbox - WS filters are not reset to "All Chats" when deleting actual workspace.[/-] [+][$250] Android - Inbox - WS filters are not reset to "All Chats" when deleting actual workspace.[/+] on Dec 17, 2024
  8. melvin-bot commented on Dec 17, 2024

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 17, 2024
  10. melvin-bot commented on Dec 17, 2024

    @melvin-bot

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

  11. 17 remaining items

  12. abekkala commented on Jan 6, 2025

    @abekkala
    Contributor

    @abdulrahuman5196 have you completed your review of the proposal?

  13. abdulrahuman5196 commented on Jan 6, 2025

    @abdulrahuman5196
    Contributor

    I seem to agree on the root cause - #53879 (comment)

    Regarding the solution.
    Updating to check a field value instead might not be the best - activeWorkspace?.type. What if in future we started storing that as well?

    shouldShowPolicy seems to be an better alternative.

    Let me just test the proposal and approve if no issues.

  14. melvin-bot commented on Jan 7, 2025

    @melvin-bot

    @abekkala @abdulrahuman5196 this issue is now 4 weeks old, please consider:

    • Finding a contributor to fix the bug
    • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  15. melvin-bot commented on Jan 7, 2025

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  16. abekkala commented on Jan 8, 2025

    @abekkala
    Contributor

    @abdulrahuman5196 were you able to test that proposal?

  17. melvin-bot commented on Jan 10, 2025

    @melvin-bot

    @abekkala, @abdulrahuman5196 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  18. abekkala commented on Jan 10, 2025

    @abekkala
    Contributor

    @abdulrahuman5196 checking in again, were you able to test the proposal above?

  19. mvtglobally commented on Jan 12, 2025

    @mvtglobally

    Issue not reproducible during KI retests. (Second week)

  20. abdulrahuman5196 commented on Jan 13, 2025

    @abdulrahuman5196
    Contributor

    Hi sorry for delay. Will check tomorrow morning.

    Meanwhile @bernhardoj Are you still able to repro the issue? Seems QA is not able to repro for 2 weeks - #53879 (comment)

  21. bernhardoj commented on Jan 14, 2025

    @bernhardoj
    Contributor

    Yes, I can't repro anymore. The code is different now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions