Skip to content

[Due for payment 2026-12-02] Spend - Export button loads infinitely after marking report as paid offline #107797

Done

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.53-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #105752
Email or phone of affected tester (no customers): sdsdojndosondjisjio@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Search

Action Performed:

Precondition:

  • Workspace is connected to Sage Intacct.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense.
  4. Submit, approve and pay the report.
  5. Wait for export to fail.
  6. Open the report.
  7. Click More > Cancel payment > Cancel payment.
  8. Go to Spend > Reports.
  9. Go offline.
  10. Bulk select the report and click Pay > Mark as paid.

Expected Result:

Export button will be shown after marking report as paid offline.

Actual Result:

Export button loads infinitely after marking report as paid offline.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7322549_1795490418826.7.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7322549

Issue OwnerCurrent Issue Owner: @suneox

Activity

  1. applause-bot commented on Nov 24, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/325cd0523747e7e9362ec01276bde3c4788ad6c515d5090f93448215c32d45cf

  2. added
    DeployBlockerCash
    Bug
    on Nov 24, 2026
  3. expensify-chore-bot commented on Nov 24, 2026

    @expensify-chore-bot

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

  4. expensify-chore-bot commented on Nov 24, 2026

    @expensify-chore-bot

    @grgia @suneox you have been assigned to this deploy blocker because you reviewed the offending PR: #105752

  5. expensify-chore-bot commented on Nov 24, 2026

    @expensify-chore-bot

    @eszlamczyk you have been assigned to this deploy blocker because you authored the offending PR: #105752

  6. expensify-chore-bot commented on Nov 24, 2026

    @expensify-chore-bot

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

  7. github-actions commented on Nov 24, 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.
  8. MelvinBot commented on Nov 24, 2026

    @MelvinBot
    Contributor

    Proposal

    Deploy recommendation: Keep blocked; revert “fix(spend): not able to pay the report via bulk section while offline” unless a targeted fix is verified before deployment.

    Confidence: Medium–High. The code explains the reported offline spinner, but browser reproduction was not performed.

    What is the root cause of that problem?

    The PR enabled offline bulk Mark as paid, exposing an existing loading state that requires a server response to finish.

    The payment optimistically updates the report and sets its Search action to loading. The report’s button changes to Export, but inherits that loading flag. While offline, the payment remains queued, so no response arrives to clear the spinner.

    This establishes persistence while offline, not that loading continues after reconnecting.

    Code evidence and release attribution

    The PR merged November 23 and is included in the staging release checklist. Ancestry inspection confirmed it is present in staging 9.5.53-0, but absent from production 9.5.52-4. It introduced access to the affected path—not the underlying loading helper.

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

    For immediate containment, revert the enabling PR; revert cleanliness remains untested.

    For a forward fix, distinguish a queued offline payment from an actively processing request. Preserve pending-payment feedback without leaving Export spinning until reconnection. Export can remain disabled offline.

    Verify the complete reported flow on web, then reconnect and verify both payment success and failure.

    Regression-test gap

    The existing bulk-payment tests mock the Search update helper, excluding the loading lifecycle responsible here. Add coverage using its actual updates.

    What alternative solutions did you explore?

    A Sage Intacct export failure alone does not explain this client-side flag remaining set offline. The separate Wise response-holding path explicitly excludes offline operation. Neither provides a stronger explanation.

    Suggested review rule: Flag newly offline-enabled writes whose button-loading state clears only on server response, without separate queued/pending presentation.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/107797) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  9. suneox commented on Nov 24, 2026

    @suneox
    Contributor

    Same root cause as #107784: after an offline bulk Mark as paid, isActionLoading stays true until the server responds. Here the flag surfaces as the Export button in the Search row. I suggest fixing both in #107784 with a single fix that covers every place reading this flag, then retesting this flow before closing this issue.

  10. kevinjosh10 commented on Nov 24, 2026

    @kevinjosh10

    Proposal

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

    When a user marks an expense report as paid via bulk actions while offline, the action button in the Spend > Reports row transitions to "Export", but becomes stuck displaying an infinite loading spinner.

    What is the root cause of that problem?

    In src/libs/actions/Search.ts (lines 600–645):

    function getOptimisticReportLoadingStateData(reportID: string, isActionLoading: boolean) {
        return {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.RAM_ONLY_REPORT_LOADING_STATE}${reportID}`,
            value: {
                isActionLoading,
            },
        };
    }
    1. PR fix(spend): not able to pay the report via bulk section while offline #105752 enabled offline bulk payment via useSearchBulkActions.ts.
    2. When payMoneyRequest is invoked, Search.ts adds optimistic data setting isActionLoading: true in RAM_ONLY_REPORT_LOADING_STATE for each paid report. The success and failure data callbacks set isActionLoading: false.
    3. However, while offline, the network request (WRITE_COMMANDS.PAY_MONEY_REQUEST) is queued in SequentialQueue and cannot execute until connectivity is restored. Consequently, neither the success data nor failure data runs while offline.
    4. In src/components/Search/SearchList/ListItem/ExpenseReportListItem.tsx (lines 126–128) and ActionCell/index.tsx (lines 111–130), the row optimistically renders the updated status (Mark as paid completed, so the button becomes Export), but reads isActionLoading from RAM_ONLY_REPORT_LOADING_STATE.
    5. Because isActionLoading remains true until the server responds, the Export button displays an infinite spinner for the duration of the offline session.

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

    In src/libs/actions/Search.ts and src/hooks/useSearchBulkActions.ts:

    1. Check network connectivity before setting optimistic isActionLoading: true. When offline (isOffline), do not set isActionLoading: true for queued actions.
    2. Offline state is already visually indicated by pendingFields and the offline indicator on the report item. Only set isActionLoading: true when a request is actively in-flight over the network:
    if (!isOffline) {
        optimisticData.push(getOptimisticReportLoadingStateData(reportID, true));
    }

    This preserves immediate optimistic status updates offline without locking the action button in a perpetual spinner.

    What alternative solutions did you explore? (Optional)?

    Reverting PR #105752 was considered, but removes offline bulk payment functionality. Conditioning isActionLoading on active network transmission provides seamless offline feedback while completely eliminating infinite spinners.

    What specific scenarios should we cover in automated tests to prevent reoccurrence?

    Add automated unit tests in tests/unit/hooks/useSearchBulkActionsPayTest.ts:

    1. Offline Bulk Mark as Paid: Verify that executing bulk Mark as paid while offline updates the report status without setting isActionLoading: true on RAM_ONLY_REPORT_LOADING_STATE.
    2. Online Bulk Mark as Paid: Verify that when online, isActionLoading: true is set optimistically and cleared upon server response.

    Contributor details?

  11. melvin-bot commented on Nov 24, 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 Nov 24, 2026

    @arosiclair
    Contributor

    CP was finished. Waiting on QA

  13. arosiclair commented on Nov 25, 2026

    @arosiclair
    Contributor
  14. removed
    DeployBlockerCash
    on Nov 25, 2026
  15. added
    Daily
    and removed
    Hourly
    on Nov 25, 2026
  16. changed the title [-]Spend - Export button loads infinitely after marking report as paid offline[/-] [+][Due for payment 2026-12-02] Spend - Export button loads infinitely after marking report as paid offline[/+] on Nov 25, 2026
  17. melvin-bot commented on Nov 25, 2026

    @melvin-bot

    @suneox

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.53-3 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-12-02. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist button]

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

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions