Skip to content

[$250] Expense - Not here page opens after invited member leaves IOU report #88420

Closed

Description

@mitarachim

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.61-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #88053
Email or phone of affected tester (no customers): sdsodijnosdjoij@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. [User A] Submit two IOU expenses to User B.
  3. [User A] Open the IOU report.
  4. [User A] Mention User C and send the mention in the report.
  5. [User A] Click Invite to chat only.
  6. [User C] Open the invited report.
  7. [User C] Click on the report header > Leave.

Expected Result:

User will be redirected to Concierge or last opened report.

Actual Result:

Not here page opens after invited member leaves IOU report.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7134833_1776772154858.3.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @sobitneupane
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022046711353886863980
  • Upwork Job ID: 2046711353886863980
  • Last Price Increase: 2026-04-28

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Apr 21, 2026
  2. melvin-bot commented on Apr 21, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #88053

  3. melvin-bot commented on Apr 21, 2026

    @melvin-bot

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

  4. github-actions commented on Apr 21, 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. MelvinBot commented on Apr 21, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    There's a race condition in leaveRoom() between three async mechanisms. When a user leaves an IOU report:

    1. Optimistic phase: Sets reportID: null and statusNum: CLOSED on the report (Report/index.ts:4451-4454). ReportNotFoundGuard still considers the report to exist because isOptimisticDelete is true (statusNum === CLOSED).

    2. Success phase (async): Uses Onyx.METHOD.SET to replace the entire report with just {reportName} (Report/index.ts:4480-4484). This wipes both reportID and statusNum, making both !!reportID and isOptimisticDelete false.

    3. Pusher leaving status (async round-trip): broadcastUserIsLeavingRoom sends a Pusher event (Report/index.ts:4433), but REPORT_USER_IS_LEAVING_ROOM is only set to true in Onyx when the event round-trips back through the Pusher server (Report/index.ts:559). There is no local/optimistic Onyx update for the current user's own leaving status.

    In ReportNotFoundGuard.tsx:51: reportExists = !!reportID || isOptimisticDelete || userLeavingStatus. If the API success response arrives before the Pusher round-trip completes, all three conditions are false → "Not here" page appears.

    PR #88053 likely surfaces this more reliably because it changed MoneyRequestReportActionsList to self-subscribe to Onyx via stable reportIDFromRoute (from route params) instead of receiving reportID as a prop from the parent. Previously, when the report was cleared, the parent MoneyRequestReportView would bail at its early-return guard, preventing child re-renders. Now the child components remain subscribed and continue re-rendering during the race window, increasing the chance of hitting the timing gap.

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

    Set REPORT_USER_IS_LEAVING_ROOM optimistically in Onyx directly inside leaveRoom(), rather than relying solely on the Pusher round-trip. Add an Onyx.merge call right before the API call in leaveRoom():

    In src/libs/actions/Report/index.ts, inside leaveRoom(), add REPORT_USER_IS_LEAVING_ROOM to the optimistic data so that ReportNotFoundGuard always sees userLeavingStatus = true throughout the entire leaving flow, regardless of Pusher timing.

    The optimisticData array should include:

    { onyxMethod: Onyx.METHOD.MERGE, key: REPORT_USER_IS_LEAVING_ROOM_{reportID}, value: true }
    

    And the successData/failureData should handle cleanup appropriately (set to false on failure; on success, the existing unsubscribeFromLeavingRoomReportChannel cleanup should handle it).

    This ensures the guard condition reportExists = !!reportID || isOptimisticDelete || userLeavingStatus always has at least one true value during the leave transition.

    What alternative solutions did you explore? (Optional)

    1. Navigate before API call: Move navigateToMostRecentReport() to fire synchronously before the API write. However, Navigation.goBack() is deferred via TransitionTracker.runAfterTransitions(), so this wouldn't fully solve the race.

    2. Keep statusNum: CLOSED in success data: Instead of wiping the report with Onyx.METHOD.SET, merge only the fields that need clearing while preserving statusNum. This would keep isOptimisticDelete true, but conflicts with the existing fix for [Due for payment 2025-03-05] [$250] Room - Room mention turns into a random number after leaving a private room #55676 which specifically needs SET to avoid showing random numbers.

    Investigation details

    Related issues:

    Key code references:

    • ReportNotFoundGuard.tsx:47-54 — The guard that determines "Not here" display
    • Report/index.ts:4419-4531 — leaveRoom() function
    • Report/index.ts:4480-4484 — Success data that wipes the report with Onyx.METHOD.SET
    • Report/index.ts:2471-2477 — broadcastUserIsLeavingRoom() sends Pusher event only
    • Report/index.ts:544-559 — Pusher subscription that sets REPORT_USER_IS_LEAVING_ROOM in Onyx (the only place it gets set to true)
    • ReportNavigateAwayHandler.tsx:137-158 — Navigate-away logic that should redirect but may fire after the guard renders

    Evidence chain: leaveRoom() → optimistic statusNum=CLOSED (guard suppressed) → API success Onyx.SET({reportName}) wipes statusNum (guard no longer suppressed) → Pusher hasn't arrived yet (userLeavingStatus=false) → reportExists=false → "Not here" page


    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.

  6. rlinoz commented on Apr 21, 2026

    @rlinoz
    Contributor

    @MelvinBot implement this

  7. MelvinBot commented on Apr 21, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: #88433
    Please mark it as "Ready for review" when it is ready for review.

  8. 22 remaining items

  9. marufsharifi commented on Apr 27, 2026

    @marufsharifi

    @sobitneupane, could you please give me your feedback on my proposals? thanks.

  10. sobitneupane commented on Apr 27, 2026

    @sobitneupane
    Contributor

    @marufsharifi I will be reviewing all proposals in the order they were submitted. I will update you once I reach yours.

  11. melvin-bot commented on Apr 27, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  12. neerajbachani commented on Apr 27, 2026

    @neerajbachani
    Contributor

    Hi @sobitneupane, I believe my PR #88804 (fixing #85943) may also resolve this issue, as both share the same root cause: after leaving an invited IOU report, the app navigates to the parent report without checking whether the current user is a participant, resulting in the "Not here" page.

    The fix adds a participant check before navigating to the parent report, and falls back to Concierge if the user isn't a participant. Could you verify whether #88804 covers this case as well?

  13. sobitneupane commented on Apr 28, 2026

    @sobitneupane
    Contributor

    @neerajbachani This looks like a duplicate of #85943 issue. I don't see any differences between the two.

    @huult Could you please also ensure this issue is resolved on "MacOS: Chrome / Safari" as well? Thanks!

  14. melvin-bot commented on Apr 28, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  15. huult commented on May 1, 2026

    @huult
    Contributor
  16. melvin-bot commented on May 1, 2026

    @melvin-bot

    @sobitneupane Whoops! This issue is 2 days overdue. Let's get this updated quick!

  17. sobitneupane commented on May 4, 2026

    @sobitneupane
    Contributor

    @rlinoz I believe we are good to close this issue. It will be handled in #85943

  18. rlinoz commented on May 4, 2026

    @rlinoz
    Contributor

    Sounds good, thanks!

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions