Skip to content

[HOLD for payment 2024-07-10] [$250] Workspace - Error page when navigate to Workspace Join link after leaving the workspace #43436

Closed

Description

@m-natarajan

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.81-1
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4609575&group_by=cases:section_id&group_order=asc&group_id=229065
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: applause internal team
Slack conversation:

Action Performed:

  1. Login to staging.expensify.com
  2. Navigate to this link - https://staging.new.expensify.com/settings/workspaces/CEFA9CA2E2CBFFC0/join?email=applausetester+joinlink@applause.expensifail.com
  3. Click on 3-dot menu> Leave
  4. Navigate to this link again - https://staging.new.expensify.com/settings/workspaces/CEFA9CA2E2CBFFC0/join?email=applausetester+joinlink@applause.expensifail.com

Expected Result:

User should be able to navigate to the workspace

Actual Result:

Error page when navigate to Workspace Join link after leaving the workspace

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

Bug6508578_1718048869729.Recording__3163.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0191daed4e48342857
  • Upwork Job ID: 1800535491968568315
  • Last Price Increase: 2024-06-25
  • Automatic offers:
    • allgandalf | Reviewer | 102892807
    • bernhardoj | Contributor | 102892809
Issue OwnerCurrent Issue Owner: @isabelastisser

Activity

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

    @melvin-bot

    Triggered auto assignment to @isabelastisser (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. m-natarajan commented on Jun 10, 2024

    @m-natarajan
    Author

    @isabelastisser FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

  4. bernhardoj commented on Jun 11, 2024

    @bernhardoj
    Contributor

    Proposal

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

    The not found page is shown when we reopen the workspace join link after leaving it.

    What is the root cause of that problem?

    When we successfully leave from a workspace, we still keep the policy object data. It's really weird that the pending action is still delete.

    const successData: OnyxUpdate[] = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
    value: {
    pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
    employeeList: {
    [sessionEmail]: null,
    },
    },
    },
    ];

    When we reopen the join link/page, the condition below detects that the workspace exists, thus we are navigated to the profile page.

    if (!isEmptyObject(policy) && !policy?.isJoinRequestPending) {
    Navigation.isNavigationReady().then(() => {
    Navigation.goBack(undefined, false, true);
    Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID ?? ''));
    });
    return;
    }

    The not found page will be shown if the policy/workspace has a pending action of delete, thus we see the not found page.

    (PolicyUtils.isPendingDeletePolicy(policy) && PolicyUtils.isPendingDeletePolicy(prevPolicy))

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

    First, we should clear the policy data after successfully leaving a workspace.

    const successData: OnyxUpdate[] = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
            value: null,
        },
    ];
    

    Next, because not found page will be shown for pending delete workspace, we need to add a new check here to make sure the pending action is not delete so we don't get navigated to the not found workspace profile page.

    if (!isEmptyObject(policy) && !policy?.isJoinRequestPending) {
    Navigation.isNavigationReady().then(() => {
    Navigation.goBack(undefined, false, true);
    Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID ?? ''));
    });
    return;
    }

    if (!isEmptyObject(policy) && !policy?.isJoinRequestPending && !PolicyUtils.isPendingDeletePolicy(policy)) {
    

    We can optionally check for the policy ID. Let me know if we want to do that

  5. moved this to Release 1: Spring 2024 (May) in [#whatsnext] #wave-collecton Jun 11, 2024
  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 11, 2024
  7. changed the title [-]Workspace - Error page when navigate to Workspace Join link after leaving the workspace[/-] [+][$250] Workspace - Error page when navigate to Workspace Join link after leaving the workspace[/+] on Jun 11, 2024
  8. melvin-bot commented on Jun 11, 2024

    @melvin-bot
  9. melvin-bot commented on Jun 11, 2024

    @melvin-bot

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

  10. isabelastisser commented on Jun 14, 2024

    @isabelastisser
    Contributor

    @abdulrahuman5196, can you please review the proposal above? Thanks!

  11. 51 remaining items

  12. isabelastisser commented on Jul 10, 2024

    @isabelastisser
    Contributor

    @AndrewGable can you please review the regression test proposal? thanks!

  13. JmillsExpensify commented on Jul 10, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

  14. isabelastisser commented on Jul 12, 2024

    @isabelastisser
    Contributor
  15. AndrewGable commented on Jul 15, 2024

    @AndrewGable
    Contributor

    Yes, looks good

  16. isabelastisser commented on Jul 15, 2024

    @isabelastisser
    Contributor

    All set!

  17. moved this from Release 1: Spring 2024 (May) to Done in [#whatsnext] #wave-collecton Jul 15, 2024
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