Skip to content

mWeb - Create Expense - “Hmm It's Not Here” page appears after deleting an expense. #85961

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.3.41-3
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-11438/folder/13177029/41237799/1266499247
Email or phone of affected tester (no customers): joelarmandotester+748@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Critical User Impact
Device used: IPhone 12 / IOS 26.3.1 / Chrome
App Component: Money Requests

Action Performed:

  1. Goto staging.new.expensify.com
  2. Sign in to an account
  3. Go to a 1:1 DM.
  4. Create two expenses.
  5. Open one of those expenses.
  6. Tap on "More" and delete the expense.

Expected Result:

It should redirect me to the other expense listed in the report.

Actual Result:

An error message saying “Hmm, it's not here” appears after deleting an expense from a report that contains multiple expenses.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7108297_1774015298621.ScreenRecording_03-20-2026_09-53-06_1.2.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 20, 2026
  2. melvin-bot commented on Mar 20, 2026

    @melvin-bot

    Triggered auto assignment to @marcochavezf (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  3. melvin-bot commented on Mar 20, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Mar 20, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Mar 20, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #79530 - "show not found page for deleted duplicate expense." by @marufsharifi (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #79530 introduced a regression in the delete expense flow. When deleting an expense from the transaction details view, the code now sets the "navigate back" URL to the current route (the expense being deleted) instead of the parent report. This causes the "Hmm, it's not here" page to appear after deletion because the app tries to navigate to a URL that no longer exists.

    Labels: No label changes needed - this is a frontend bug and DeployBlockerCash should remain.

    📋 Detailed Analysis

    Evidence

    PR #79530 was merged on 2026-02-25 and added logic to handle navigation after deleting expenses, primarily focused on duplicate expense scenarios. However, it also modified the regular delete flow in MoneyRequestHeader.tsx.

    The bug is reproducible:

    • On staging (9.3.41-3): Yes ✅
    • On production (9.3.40-11): No ❌

    This confirms the causing PR is in staging but not yet in production.

    Verification

    The affected code is in /home/runner/_work/App/App/src/components/MoneyRequestHeader.tsx at lines 608-609:

    const backToRoute = route.params?.backTo ?? Navigation.getActiveRoute();
    setDeleteTransactionNavigateBackUrl(backToRoute);

    When a user is viewing an expense (e.g., route /r/123456/transaction/789), deleting it sets backToRoute to that same expense route. After deletion completes, the navigation logic tries to navigate to this now-deleted expense, triggering the "Not Found" page.

    Root Cause

    The issue is in the fallback logic: Navigation.getActiveRoute() returns the current route, which is the expense being deleted. The code should instead navigate to:

    1. The parent report (if there are multiple expenses)
    2. Another expense in the same report
    3. The chat that contains the report

    PR #79530's changes were primarily intended for duplicate expense review flows but inadvertently affected the standard expense deletion flow, causing this regression.

  6. MelvinBot commented on Mar 20, 2026

    @MelvinBot
    Contributor

    Proposal

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

    On mWeb, when a user deletes one expense from a report that contains multiple expenses (in a 1:1 DM), a "Hmm, it's not here" not-found page appears instead of navigating back to the remaining expense(s). This is reproducible on staging but not production.

    What is the root cause of that problem?

    The deletion flow in MoneyRequestHeader.tsx performs two separate Onyx operations sequentially:

    1. setDeleteTransactionNavigateBackUrl(backToRoute) at line 609 — calls Onyx.set(ONYXKEYS.NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL, url) (src/libs/actions/Report/index.ts:5589-5591)
    2. deleteTransactions([...]) at line 627 — internally calls deleteMoneyRequest → API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST, params, {optimisticData}) which applies optimistic Onyx updates marking the parent report action with pendingAction: DELETE

    The shouldShowNotFoundPage logic in ReportScreen.tsx (line 488-531) relies on the deleteTransactionNavigateBackUrl being set (line 497-499) to suppress the not-found check when isDeletedTransactionThread becomes true (line 501-503). These two values come from separate Onyx keys subscribed via separate useOnyx hooks.

    The race condition is: Onyx.set (for the URL) and API.write → Onyx.update (for the optimistic deletion data) go through different internal Onyx code paths. If the deletion's optimistic updates propagate to the useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS) subscriber (making isDeletedTransactionThread = true) before the URL propagates to useOnyx(ONYXKEYS.NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL), there is a render window where:

    • isDeletedTransactionThread = true (parent action marked as DELETE)
    • deleteTransactionNavigateBackUrl = undefined (not yet delivered)
    • shouldShowNotFoundPage returns true → "Hmm, it's not here" appears

    This explains why it's mWeb-specific and staging-only — it's a timing-sensitive race that depends on Onyx's internal batching behavior and React's render scheduling, which can vary between builds and platforms.

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

    Include the NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL update as part of the deleteMoneyRequest optimistic data in src/libs/actions/IOU/index.ts, so it's applied atomically in the same Onyx.update() call as the deletion's optimistic updates. This eliminates the race condition by ensuring both changes are delivered to React in the same render cycle.

    Specifically, in deleteMoneyRequest (around line 8573 in src/libs/actions/IOU/index.ts), add an optimistic data entry for NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL and accept it as a parameter. Then update MoneyRequestHeader.tsx and MoneyReportHeader.tsx to pass the navigate-back URL through to deleteTransactions/deleteMoneyRequest instead of setting it separately via setDeleteTransactionNavigateBackUrl.

    Alternatively, a simpler fix: in shouldShowNotFoundPage (ReportScreen.tsx:488), add a check that also suppresses the not-found page when the parent report action has pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE — this would be a secondary safety net that doesn't rely on the deleteTransactionNavigateBackUrl timing at all.

    What alternative solutions did you explore? (Optional)

    1. Awaiting the Onyx.set promise before calling deleteTransactions — this would guarantee order but introduces an unnecessary async gap and could cause other timing issues.
    2. Moving the navigation before the deletion — not viable because the user needs to see the confirm modal result first.
    3. Using Onyx.multiSet to batch both the URL and deletion in one call — this would work but requires restructuring the API call pattern.

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. cristipaval commented on Mar 20, 2026

    @cristipaval
    Contributor

    DUpe of #85954

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions