Skip to content

[Due for payment 2025-07-01] [$250] Workspace - Unexpected Error in My Account After Deleting the Only Workspace #63948

Closed

Description

@jponikarchuk

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: v9.1.64-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/6197541
Email or phone of affected tester (no customers): na
Issue reported by: Applause Internal Team
Device used: Win11/chrome
App Component: Workspace Settings

Action Performed:

Precondition : Create a new account without any Workspace

  1. Open the link www.staging.new.expensify.com (build version v9.1.64-0)
  2. Log in as owner
  3. Click FAB >> Click "new Workspace"
  4. Create a Workspace
  5. Go to My account and click on "subscriptions'
  6. Go to Workspace and deleted the workspace via 3 dots
  7. Go go My account and observe that the page is show "hmm...its not here"
  8. Tap the back arrow, nothing is triggered

Expected Result:

When the only Workspace is deleted, navigating to My Account should not result in an error.

Actual Result:

After deleting the only Workspace, navigating to My Account > Subscriptions displays an error: "Hmm... it's not here."

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021932850863780346928
  • Upwork Job ID: 1932850863780346928
  • Last Price Increase: 2025-06-11
  • Automatic offers:
    • daledah | Contributor | 107711173
Issue OwnerCurrent Issue Owner: @NicMendonca

Activity

  1. added
    Daily
    Bug
    on Jun 11, 2025
  2. melvin-bot commented on Jun 11, 2025

    @melvin-bot

    Triggered auto assignment to @NicMendonca (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. daledah commented on Jun 11, 2025

    @daledah
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-06-11 10:24:05 UTC.

    Proposal

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

    After deleting the only Workspace, navigating to My Account > Subscriptions displays an error: "Hmm... it's not here."

    What is the root cause of that problem?

    After deleting the only workspace, when opening account tab we navigate to last visited route in accounts tab

    const lastVisitedSettingsRoute = getLastVisitedTabPath(settingsTabState);
    if (lastVisitedSettingsRoute) {
    Navigation.navigate(lastVisitedSettingsRoute);
    return;
    }

    And since the only workspace is deleted, subscriptionPlan is cleared so Not found page is shown

    if (!subscriptionPlan) {
    return <NotFoundPage />;
    }

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

    We should navigate back to Settings profile page if the last visited settings route is subscription page and workspace is deleted when opening account tab.

    Add after here

    const lastVisitedSettingsRoute = getLastVisitedTabPath(settingsTabState);

        const subscriptionPlan = useSubscriptionPlan();
                    if (!subscriptionPlan && lastVisitedSettingsRoute?.startsWith(`/${ROUTES.SETTINGS_SUBSCRIPTION.route}`)) {
                        Navigation.navigate(ROUTES.SETTINGS_PROFILE.route);
                        return;
                    }

    Or we can check using state name instead of Array.startsWith.

                    const stateRoute = findFocusedRoute(settingsTabState);
                    if (!subscriptionPlan && stateRoute?.name === SCREENS.SETTINGS.SUBSCRIPTION.ROOT) {
                        Navigation.navigate(ROUTES.SETTINGS_PROFILE.route);
                        return;
                    }

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

    None, Navigation issue

    What alternative solutions did you explore? (Optional)

    NA

    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.

  4. linhvovan29546 commented on Jun 11, 2025

    @linhvovan29546
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-06-11 10:53:24 UTC.

    Proposal

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

    Workspace - Unexpected Error in My Account After Deleting the Only Workspace

    What is the root cause of that problem?

    On the Subscription page, if subscriptionPlan is false/undefined, we render a "not found" page. As a result, if the user no longer has any owned policy (i.e., they deleted their last workspace), accessing the Subscription page will show a "not found" error. From OP, after deleting the last workspace, the Subscription page remains as the last accessed settings page. Therefore, when the user clicks the Settings tab, the app attempts to open the Subscription page, which results in an error

    if (!subscriptionPlan) {
    return <NotFoundPage />;
    }

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

    I think we can reset the last visited settings tab when the user deletes their last workspace

    const params: DeleteWorkspaceParams = {policyID};

    function getLastVisitedSettingTabScreen() {
        const settingsTabState = getSettingsTabStateFromSessionStorage();
        return settingsTabState?.routes?.at(-1)?.state?.routes?.at(-1)?.name;
    }
    ...
    // We can consider excluding this for the narrow layout.
        if(shouldCalculateBillNewDot()){
            const lastAccessedSettingScreen = getLastVisitedSettingTabScreen(); // <--- retrieving state from session storage
    // Note: Instead compare with screen name we can get the path from function above and compare like this lastAccessedSettingScreen.includes(ROUTES.SETTINGS_SUBSCRIPTION.route)
            if (lastAccessedSettingScreen && lastAccessedSettingScreen === SCREENS.SETTINGS.SUBSCRIPTION.ROOT) {
                    saveSettingsTabPathToSessionStorage(ROUTES.SETTINGS_PROFILE.route);
            }
        }
    ...
    =>  API.write

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

    We can write a unit test for getTabStateFromSessionStorage by calling the delete workspace and then asserting that the url is updated as expected.

    What alternative solutions did you explore? (Optional)

    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.

  5. added
    External
    on Jun 11, 2025
  6. changed the title [-]Workspace - Unexpected Error in My Account After Deleting the Only Workspace[/-] [+][$250] Workspace - Unexpected Error in My Account After Deleting the Only Workspace[/+] on Jun 11, 2025
  7. melvin-bot commented on Jun 11, 2025

    @melvin-bot
  8. added
    Help Wanted
    on Jun 11, 2025
  9. melvin-bot commented on Jun 11, 2025

    @melvin-bot

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

  10. melvin-bot commented on Jun 17, 2025

    @melvin-bot

    @ZhenjaHorbach Eep! 4 days overdue now. Issues have feelings too...

  11. ZhenjaHorbach commented on Jun 17, 2025

    @ZhenjaHorbach
    Contributor

    Not overdue
    I will check today

  12. 10 remaining items

  13. added
    Weekly
    Awaiting Payment
    and removed
    Weekly
    on Jun 24, 2025
  14. changed the title [-][$250] Workspace - Unexpected Error in My Account After Deleting the Only Workspace[/-] [+][Due for payment 2025-07-01] [$250] Workspace - Unexpected Error in My Account After Deleting the Only Workspace[/+] on Jun 24, 2025
  15. removed
    Reviewing
    on Jun 24, 2025
  16. melvin-bot commented on Jun 24, 2025

    @melvin-bot

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

  17. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.70-7 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-07-01. 🎊

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

  18. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    @ZhenjaHorbach @NicMendonca @ZhenjaHorbach 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]

  19. added
    Daily
    and removed
    Weekly
    on Jul 1, 2025
  20. ZhenjaHorbach commented on Jul 2, 2025

    @ZhenjaHorbach
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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: https://github.com/Expensify/App/pull/62344/files#r2179254348

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Test:

    1. Create new account
    2. Create a workspace
    3. Go to Accounts -> Subscription
    4. Go to Workspace and delete the created Workspace
    5. Go to Accounts
    6. Verify that: We are navigated to Settings Profile Page

    Do we agree 👍 or 👎

  21. NicMendonca commented on Jul 2, 2025

    @NicMendonca
    Contributor

    Payment summary

    Contributor: @daledah - $250 via Upwork (done ✅ )
    Contributor+: @ZhenjaHorbach - $250 via NewDot

  22. ZhenjaHorbach commented on Jul 2, 2025

    @ZhenjaHorbach
    Contributor

    Requested in ND

  23. garrettmknight commented on Jul 21, 2025

    @garrettmknight
    Contributor

    $250 approved for @ZhenjaHorbach

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions