Skip to content

[Due for payment 2026-05-20] Expense - Report loads infinitely after paying offline #90030

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.69-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: #89615
Email or phone of affected tester (no customers): sjdosjdosjdojnsodj@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. Go to workspace chat.
  3. Create an expense.
  4. Open the report.
  5. Click Submit and Approve.
  6. Go offline.
  7. Click Mark as paid.

Expected Result:

Report will not load infinitely after paying offline.

Actual Result:

Report loads infinitely after paying offline.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7148494_1778255599503.6.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.
    DeployBlockerIndicates it should block deploying the API
    on May 8, 2026
  2. melvin-bot commented on May 8, 2026

    @melvin-bot

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

  3. melvin-bot commented on May 8, 2026

    @melvin-bot

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

  4. github-actions commented on May 8, 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 May 8, 2026

    @MelvinBot
    Contributor

    Proposal

    Problem: PR #89615 moved the offline→online flush() subscriber and the addBecameActiveListener from module-level side effects into an initReconnect() function that is called from a React useEffect in Expensify.tsx. This creates a timing gap where the network can transition from offline→online before the subscriber is registered, so flush() is never called and the persisted PayMoneyRequest command never reaches the server — leaving the report stuck with pendingAction: ADD and an infinite loading skeleton.

    Root Cause: The offline→online network state subscriber that calls flush() is no longer registered at module load time. It now requires initReconnect() to be called first, which only happens inside a useEffect in Expensify.tsx (runs asynchronously after render). Meanwhile, NetworkState.ts subscribes to NetInfo at module load time (configureAndSubscribe()), so it can detect and broadcast network transitions before the flush subscriber exists to receive them. The one-time startup flush in Network/index.ts also doesn't help if the device is offline at that point — flush() returns early.

    Solution: Revert the offline→online flush subscriber and addBecameActiveListener back to module-level side effects (executed on import), as they were before PR #89615. These listeners must be registered before any network transition can occur. The initReconnect() wrapper and the useEffect call site in Expensify.tsx should be removed.

    Specifically:

    1. In Reconnect.ts: Move the subscribeNetworkState(...) and AppStateMonitor.addBecameActiveListener(...) calls back to module scope (outside any function). Reinitialize wasOffline to getIsOffline() at declaration time.
    2. In Expensify.tsx: Remove the useEffect that calls initReconnect() and the didInitReconnectRef.
    Investigation details

    Timeline of the regression:

    The original Reconnect.ts had the flush subscriber at module scope:

    let wasOffline = getIsOffline();
    subscribeNetworkState(() => { ... flush() ... });
    AppStateMonitor.addBecameActiveListener(() => { ... flush() ... });

    PR #89615 wrapped these in initReconnect() and deferred execution to a useEffect:

    let wasOffline: boolean; // uninitialized until initReconnect()
    const initReconnect = () => {
        wasOffline = getIsOffline();
        subscribeNetworkState(() => { ... });
        AppStateMonitor.addBecameActiveListener(() => { ... });
    };

    Why this causes the infinite loading:

    1. User goes offline and taps "Mark as paid" → PayMoneyRequest is queued in PersistedRequests, optimistic Onyx updates applied (pendingAction: ADD on report action, pendingFields on report)
    2. NetworkState detects offline→online transition via NetInfo (registered at module load, line 351)
    3. NetworkState calls notifyListeners() → but the Reconnect.ts subscriber hasn't been registered yet (useEffect hasn't fired)
    4. flush() is never called → PayMoneyRequest stays in the persisted queue → server never processes it → successData (which clears pendingAction and pendingFields) never runs
    5. The report remains stuck with pending states, showing an infinite loading skeleton

    Alternative explanations considered:

    • shouldWaitForTransactions skeleton: Could contribute if RAM_ONLY_REPORT_LOADING_STATE resets, but the primary cause is the flush never happening
    • onReachabilityConfirmed (line 58): This calls reconnect() (which syncs app data) but does NOT call flush(), so it doesn't help flush the persisted payment command

    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. arosiclair commented on May 8, 2026

    @arosiclair
    Contributor

    I'm having trouble reproducing right now because the inbox tab keeps crashing on staging

  7. arosiclair commented on May 8, 2026

    @arosiclair
    Contributor

    No repro in prod v9.3.68-3. Okay I reproduced in staging v9.3.69-0

  8. 6 remaining items

  9. arosiclair commented on May 8, 2026

    @arosiclair
    Contributor

    This revert also fixes some crashes in the inbox tab. Requested a CP here

  10. melvin-bot commented on May 8, 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.

  11. melvin-bot commented on May 8, 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. arosiclair commented on May 8, 2026

    @arosiclair
    Contributor

    Fixed in v9.3.69-1

  13. melvin-bot commented on May 12, 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.

  14. changed the title [-]Expense - Report loads infinitely after paying offline[/-] [+][Due for payment 2026-05-20] Expense - Report loads infinitely after paying offline[/+] on May 13, 2026
  15. melvin-bot commented on May 13, 2026

    @melvin-bot

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

  16. melvin-bot commented on May 13, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.72-1 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 2026-05-20. 🎊

  17. melvin-bot commented on May 13, 2026

    @melvin-bot

    @arosiclair 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]

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.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions