Skip to content

[Due for payment 2025-12-04] [$250] Android - Workspace - "It´s not here" briefly seen after deleting workspace from "Overview" #73137

Closed

Description

@lanitochka17

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.2.35-0
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://test-management.browserstack.com/projects/2219752/test-runs/TR-1392/folder/13177080/41237957/964488860
Email or phone of affected tester (no customers): ibellicotest+1942@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

Prerequisite: Account has at least one workspace

  1. Open the Expensify app
  2. Navigate to "Workspaces" and open any workspace
  3. Tap on "Overview"
  4. Tap on "More" and delete the workspace
  5. Note that before being redirected to workspaces list, an "It´s not here" page is briefly displayed

Expected Result:

After deleting a workspace from the "More" menu on "Overview", user should be automatically redirected to workspaces list

Actual Result:

After deleting a workspace from the "More" menu on "Overview", an "It´s not here" page is briefly displayed, before landing on the workspaces list

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6980773_1761066229319.More.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021981775013425327474
  • Upwork Job ID: 1981775013425327474
  • Last Price Increase: 2025-10-24
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @zanyrenney

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 21, 2025
  2. melvin-bot commented on Oct 21, 2025

    @melvin-bot

    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.

  3. lorretheboy commented on Oct 21, 2025

    @lorretheboy
    Contributor

    Proposal

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

    After deleting a workspace from the "More" menu on "Overview", an "It´s not here" page is briefly displayed, before landing on the workspaces list

    What is the root cause of that problem?

    The confirmDelete function was calling deleteWorkspace immediately, which optimistically set pendingAction: DELETE on the policy

    useEffect was watching for the deletion to complete and only then navigating away

    During this time, the WorkspacePageWithSections component detected the policy was being deleted and showed the "not found" page

    const confirmDelete = useCallback(() => {
    if (!policy?.id || !policyName) {
    return;
    }
    deleteWorkspace(policy.id, policyName, lastAccessedWorkspacePolicyID, defaultCardFeeds, reportsToArchive, transactionViolations, reimbursementAccountError, lastPaymentMethod);
    }, [policy?.id, policyName, lastAccessedWorkspacePolicyID, defaultCardFeeds, reportsToArchive, transactionViolations, reimbursementAccountError, lastPaymentMethod]);

    useEffect(() => {
    if (!isFocused || !prevIsPendingDelete || isPendingDelete) {
    return;
    }
    setIsDeleteModalOpen(false);
    if (!policyLastErrorMessage) {
    goBackFromInvalidPolicy();
    return;
    }
    setIsDeleteWorkspaceErrorModalOpen(true);
    }, [isFocused, isPendingDelete, prevIsPendingDelete, policyLastErrorMessage]);

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

    We should update confirmDelete to navigate away FIRST using goBackFromInvalidPolicy()

    And use InteractionManager.runAfterInteractions to delay the actual deleteWorkspace call until after the navigation completes (This will be deprecated soon, however, we haven't decided solution so we could go with requestIdleCallback or setTimeOut or any other ways to delay the action if needed)

            setIsDeleteModalOpen(false);
            goBackFromInvalidPolicy();
            // eslint-disable-next-line @typescript-eslint/no-deprecated
            InteractionManager.runAfterInteractions(() => {
                deleteWorkspace(policy.id, policyName, lastAccessedWorkspacePolicyID, defaultCardFeeds, reportsToArchive, transactionViolations, reimbursementAccountError, lastPaymentMethod);
            });

    deleteWorkspace(policy.id, policyName, lastAccessedWorkspacePolicyID, defaultCardFeeds, reportsToArchive, transactionViolations, reimbursementAccountError, lastPaymentMethod);

    Update the useEffect to only handle showing the error modal if deletion fails (removed the navigation logic)

            if (policyLastErrorMessage) {
                setIsDeleteWorkspaceErrorModalOpen(true);
            }

    setIsDeleteModalOpen(false);
    if (!policyLastErrorMessage) {
    goBackFromInvalidPolicy();
    return;
    }
    setIsDeleteWorkspaceErrorModalOpen(true);

    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.

  4. samranahm commented on Oct 21, 2025

    @samranahm
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-11-11 14:44:02 UTC.

    Proposal

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

    It's not here" briefly seen after deleting workspace from Overview

    What is the root cause of that problem?

    The logic for determining when to show the NotFound page has a flaw in the second return statement. Specifically, the condition (!shouldShowPolicy && (!isPendingDelete || prevIsPendingDelete)) incorrectly evaluates to true when a workspace has just been deleted.

    When deletion completes: isPendingDelete = false and prevIsPendingDelete = true, so (!isPendingDelete || prevIsPendingDelete) becomes true, which triggers the NotFound page to show.

    return (!isEmptyObject(policy) && !isPolicyAdmin(policy) && !shouldShowNonAdmin) || (!shouldShowPolicy && (!isPendingDelete || prevIsPendingDelete));

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

    We should fix the logic to use AND conditions instead of OR for the pending delete checks. This ensures the NotFound page only shows when the workspace is neither currently being deleted nor was just deleted.

    Change the return statement from

    return (!isEmptyObject(policy) && !isPolicyAdmin(policy) && !shouldShowNonAdmin) || (!shouldShowPolicy && (!isPendingDelete || prevIsPendingDelete));

    To

    return (!isEmptyObject(policy) && !isPolicyAdmin(policy) && !shouldShowNonAdmin) || (!shouldShowPolicy && !isPendingDelete && !prevIsPendingDelete);

    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. dmkt9 commented on Oct 22, 2025

    @dmkt9
    Contributor

    Proposal

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

    After deleting a workspace from the "More" menu on "Overview", an "It´s not here" page is briefly displayed, before landing on the workspaces list

    What is the root cause of that problem?

    1. FullPageNotFoundView is rendered based on the value of shouldShow:

      onBackButtonPress={() => Navigation.goBack(ROUTES.WORKSPACES_LIST.route)}
      onLinkPress={goBackFromInvalidPolicy}
      shouldShow={shouldShow}
      subtitleKey={shouldShowPolicy ? 'workspace.common.notAuthorized' : undefined}
      shouldForceFullScreen
      shouldDisplaySearchRouter
      >
      <HeaderWithBackButton

    2. Immediately after deleting a workspace, the shouldShow value is still set to true because the condition (!shouldShowPolicy && (!isPendingDelete || prevIsPendingDelete)) evaluates to true as soon as the policy is updated for deletion.

      const shouldShow = useMemo(() => {
      // If the policy object doesn't exist or contains only error data, we shouldn't display it.
      if (((isEmptyObject(policy) || (Object.keys(policy).length === 1 && !isEmptyObject(policy.errors))) && isEmptyObject(policyDraft)) || shouldShowNotFoundPage) {
      return true;
      }
      // We check isPendingDelete and prevIsPendingDelete to prevent the NotFound view from showing right after we delete the workspace
      return (!isEmptyObject(policy) && !isPolicyAdmin(policy) && !shouldShowNonAdmin) || (!shouldShowPolicy && (!isPendingDelete || prevIsPendingDelete));
      // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
      }, [policy, shouldShowNonAdmin, shouldShowPolicy]);

      On Android, even minor changes can trigger a re-render, which results in the "It’s not here" page being displayed.

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

    We should delay rendering the NotFound page until prevPolicy is also no longer in a delete-pending state.

    const shouldShow = useMemo(() => {
    // If the policy object doesn't exist or contains only error data, we shouldn't display it.
    if (((isEmptyObject(policy) || (Object.keys(policy).length === 1 && !isEmptyObject(policy.errors))) && isEmptyObject(policyDraft)) || shouldShowNotFoundPage) {
    return true;
    }
    // We check isPendingDelete and prevIsPendingDelete to prevent the NotFound view from showing right after we delete the workspace
    return (!isEmptyObject(policy) && !isPolicyAdmin(policy) && !shouldShowNonAdmin) || (!shouldShowPolicy && (!isPendingDelete || prevIsPendingDelete));
    // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
    }, [policy, shouldShowNonAdmin, shouldShowPolicy]);

    + const prevShouldShowPolicy = useMemo(() => shouldShowPolicyUtil(prevPolicy, false, currentUserLogin), [prevPolicy, currentUserLogin]);
    const shouldShow = useMemo(() => {
            ...existing code
    
            // We check isPendingDelete and prevIsPendingDelete to prevent the NotFound view from showing right after we delete the workspace
    -       return (!isEmptyObject(policy) && !isPolicyAdmin(policy) && !shouldShowNonAdmin) || (!shouldShowPolicy && (!isPendingDelete || prevIsPendingDelete));
    +       return (!isEmptyObject(policy) && !isPolicyAdmin(policy) && !shouldShowNonAdmin) || (!shouldShowPolicy && !isPendingDelete && !prevShouldShowPolicy && !prevIsPendingDelete);
            // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
        }, [policy, shouldShowNonAdmin, shouldShowPolicy]);

    What alternative solutions did you explore? (Optional)

    NA

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 24, 2025
  7. changed the title [-]Android - Workspace - "It´s not here" briefly seen after deleting workspace from "Overview"[/-] [+][$250] Android - Workspace - "It´s not here" briefly seen after deleting workspace from "Overview"[/+] on Oct 24, 2025
  8. melvin-bot commented on Oct 24, 2025

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

    @melvin-bot

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

  11. 48 remaining items

  12. situchan commented on Dec 1, 2025

    @situchan
    Contributor

    BugZero Checklist:

    • [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/55508/files#r2575495270

    • [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: N/A

    • [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.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Already exists https://test-management.browserstack.com/projects/2219752/test-runs/TR-1392/folder/13177080/41237957/964488860

  13. zanyrenney commented on Dec 4, 2025

    @zanyrenney
    Contributor
  14. samranahm commented on Dec 4, 2025

    @samranahm
    Contributor

    Thank you @zanyrenney, I've applied for the job.

  15. zanyrenney commented on Dec 4, 2025

    @zanyrenney
    Contributor

    offer sent @samranahm

  16. zanyrenney commented on Dec 4, 2025

    @zanyrenney
    Contributor

    @situchan can you also apply please?

  17. situchan commented on Dec 4, 2025

    @situchan
    Contributor

    @zanyrenney can you please unassign and assign me back?

  18. melvin-bot commented on Dec 4, 2025

    @melvin-bot

    ❌ There was an error making the offer to @situchan for the Contributor role. The BZ member will need to manually hire the contributor.

  19. situchan commented on Dec 4, 2025

    @situchan
    Contributor

    Hmm, it didn't work. ok, I will apply

    Edit: applied

  20. zanyrenney commented on Dec 4, 2025

    @zanyrenney
    Contributor

    payment summary

    @situchan requires payment (Needs manual offer from BZ) - paid $250 on upwork.
    @samranahm requires payment (Needs manual offer from BZ) paid $250 on upwork.

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