Skip to content

[HOLD for payment 2024-08-09] [$250] Workspace switcher - WS switcher and LHN are not reset to Expensify after leaving workspace #43981

Closed

Description

@izarutskaya

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: 1.4.85-4
Reproducible in staging?: Y
Reproducible in production?: Y
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

Precondition:

  • User is invited to a workspace.
  1. Go to staging.new.expensify.com
  2. Open workspace switcher.
  3. Select the invited workspace.
  4. Go to Account settings > Workspaces.
  5. Click 3-dot menu on the invited workspace > Leave.
  6. Return to LHN.

Expected Result:

  • Workspace switcher will switch to Expensify.
  • LHN will show all the chats because Expensify is selected.

Actual Result:

  • Workspace switcher displays Expensify, but when opening the workspace list, Expensify is not selected.
  • LHN still shows the filtered chats.

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

20240619_131605.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018dbe15d720ffa01b
  • Upwork Job ID: 1804259959268757378
  • Last Price Increase: 2024-06-21
  • Automatic offers:
    • truph01 | Contributor | 103068211
Issue OwnerCurrent Issue Owner: @johncschuster

Activity

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

    @melvin-bot

    Triggered auto assignment to @johncschuster (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. izarutskaya commented on Jun 19, 2024

    @izarutskaya
    Author

    We think this issue might be related to the #vip-vsb

  4. tsa321 commented on Jun 19, 2024

    @tsa321
    Contributor

    Proposal

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

    Workspace switcher - WS switcher and LHN are not reset to Expensify after leaving workspace

    What is the root cause of that problem?

    We don't have check on currently accessed policy, whether the user is still member of the policy or the policy is not deleted, Inside callback of Onyx connect to policy collection.

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

    We can make a callback in onyx policy collection, then check if currently accessed policy is deleted or the user is not member anymore, then updateLastAccessedWorkspace(undefined);

    Is this expected result? Or should we show modal if the remove member or delete workspace action are from other user?
    the confirm modal could be. You are no longer member of ..... Then ask Do you want to change the workspace Expensify? ` if user is in report screen.

  5. truph01 commented on Jun 19, 2024

    @truph01
    Contributor

    Proposal

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

    Workspace switcher displays Expensify, but when opening the workspace list, Expensify is not selected.
    LHN still shows the filtered chats.

    What is the root cause of that problem?

    In deleteWorkspace function

    // Reset the lastAccessedWorkspacePolicyID
    if (policyID === lastAccessedWorkspacePolicyID) {
    updateLastAccessedWorkspace(undefined);
    }
    }

    We have logic to update the lastAccessedWorkspacePolicyID, but we missed it in the leaveWorkspace function

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

    • We can add a new listener to BaseSidebarScreen component:
        const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
        const selectedPolicy = Object.values(policies ?? {}).find((o) => o?.id === activeWorkspaceID);
        const prevSelectedPolicy = usePrevious(selectedPolicy);
        useEffect(() => {
            if (!selectedPolicy && !prevSelectedPolicy) {
                return;
            }
            if (prevSelectedPolicy && !selectedPolicy && activeWorkspaceID !== undefined) {
                Navigation.navigateWithSwitchPolicyID({policyID: undefined});
                updateLastAccessedWorkspace(undefined);
            }
        }, [prevSelectedPolicy, selectedPolicy, activeWorkspaceID]);
    
    • So once the selected policy is undefined, it will switch to the default policy.

    What alternative solutions did you explore? (Optional)

    API.write(WRITE_COMMANDS.LEAVE_POLICY, params, {optimisticData, successData, failureData});

    here, we also should add

    if (policyID === lastAccessedWorkspacePolicyID) {
            updateLastAccessedWorkspace(undefined);
        }
    
  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 21, 2024
  7. changed the title [-]Workspace switcher - WS switcher and LHN are not reset to Expensify after leaving workspace[/-] [+][$250] Workspace switcher - WS switcher and LHN are not reset to Expensify after leaving workspace[/+] on Jun 21, 2024
  8. melvin-bot commented on Jun 21, 2024

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

    @melvin-bot

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

  11. 37 remaining items

  12. changed the title [-][$250] Workspace switcher - WS switcher and LHN are not reset to Expensify after leaving workspace[/-] [+][HOLD for payment 2024-08-09] [$250] Workspace switcher - WS switcher and LHN are not reset to Expensify after leaving workspace[/+] on Aug 2, 2024
  13. melvin-bot commented on Aug 2, 2024

    @melvin-bot

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

  14. melvin-bot commented on Aug 2, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.15-9 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 2024-08-09. 🎊

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

  15. melvin-bot commented on Aug 2, 2024

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@s77rt] The PR that introduced the bug has been identified. Link to the PR:
    • [@s77rt] 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:
    • [@s77rt] 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:
    • [@s77rt] Determine if we should create a regression test for this bug.
    • [@s77rt] 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.
    • [@johncschuster] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  16. s77rt commented on Aug 5, 2024

    @s77rt
    Member
    • The PR that introduced the bug has been identified: More like a missed case [Wave 8] Ideal nav  #33280
    • The offending PR has been commented on: [Wave 8] Ideal nav  #33280 (comment)
    • A discussion in #expensify-bugs has been started: Not needed, one of a kind bug
    • Determine if we should create a regression test for this bug: No, low priority
  17. johncschuster commented on Aug 5, 2024

    @johncschuster
    Contributor

    Acknowledged! I'll issue payment after the regression threshold is cleared.

  18. johncschuster commented on Aug 7, 2024

    @johncschuster
    Contributor

    Payment Summary

    Contributor: @truph01 paid $250 via Upwork (paid on 2024-08-09)
    Contributor+: @s77rt owed $250 via NewDot

  19. johncschuster commented on Aug 9, 2024

    @johncschuster
    Contributor

    Payment has been issued via Upwork to @truph01. Go ahead and request payment on ND, @s77rt! Thank you both for your contributions! 🎉

  20. JmillsExpensify commented on Aug 9, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @s77rt

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

Metadata

Metadata

Labels

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

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions