Skip to content

[Due for payment 2026-08-21] Spends - Pay option isn't shown in offline mode on bulk selection #97753

Closed

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: v9.4.49-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #97581
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 / Chrome, iPhone 13 / iOS 27 Beta, Samsung Galaxy A52 / Android 14
App Component: Search

Action Performed:

Preconditions:

  1. Prepare 2 accounts named Account A & Account B
  2. Account A create 2 workspaces named Workspace A & Workspace B
  3. Workspace A connect to Bank Account via Workflow -> Payment -> Add bank account
  4. Workspace B invite Account B
  5. Account B create 2 reports and add expense in each report and submit it
  6. Account A approve those expense reports from account B
  7. Account A navigate to Spends -> Reports and filter the workspace to workspace 2

Steps:
8. [Account A] go offline
9. [Account A] select 2 approved report created by account B
10. [Account A] click "N selected" dropdown

Expected Result:

Pay option should be shown after clicking "N selected" dropdown in offline mode, so user can verify the offline modal appears and no payment is attempted

Actual Result:

Pay option isn't shown after clicking "N selected" dropdown in offline mode

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7225168_1785808216471.bandicam_2026-08-04_08-34-30-295.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7225168

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 4, 2026
  2. applause-bot commented on Aug 4, 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/b83cd9d3523b30481a4f0ea294c5c2c67eb205d7dde2980e21e9e0b804ea5f6d

  3. changed the title [-]Spends-Pay option isn't shown in offline mode on bulk selection[/-] [+]Spends - Pay option isn't shown in offline mode on bulk selection[/+] on Aug 4, 2026
  4. MelvinBot commented on Aug 4, 2026

    @MelvinBot
    Contributor

    Proposal

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

    On Search → Reports, when a user is offline and selects 2+ approved ("Ready to pay") reports, the Pay option is missing from the "N selected" dropdown. It appears normally when online. Expected: Pay should still be shown offline so that clicking it surfaces the offline modal (no payment is attempted).

    What is the root cause of that problem?

    The bulk-action options array explicitly gates the Pay option behind !isOffline when it is built, so the item is never pushed into the dropdown while offline.

    src/hooks/useSearchBulkActions.ts:2077:

    const shouldShowPayOption = !isOffline && !isAnyTransactionOnHold && shouldEnableBulkPayOption && !!bulkPayButtonOptions?.length;

    The smoking gun is that the Pay click handler already contains dead code meant to handle the offline case — but it can never be reached because line 2077 removes the option before a user can click it:

    src/hooks/useSearchBulkActions.ts:1171-1174:

    if (isOffline) {
        setIsOfflineModalVisible(true);
        return;
    }

    This is the intended offline behavior (show the modal), which confirms Pay was meant to render offline. The !isOffline conjunct on line 2077 contradicts it.

    Why it's this and not a data-availability issue

    !isOffline is the sole cause — the other conjuncts stay truthy offline:

    • shouldEnableBulkPayOption comes from getPayOption(...) operating on already-selected reports and Onyx-persisted lastPaymentMethods.
    • bulkPayButtonOptions is built from bankAccountList/fundList, which are Onyx collections that persist offline.

    So getBusinessBankAccountOptions returning empty is not the cause; the bank-account data survives offline. This is a deterministic client-side render gate — no logs needed. Note this !isOffline gate is pre-existing, not introduced by #97581 (that PR only added Log.info lines here); QA on #97581 surfaced it because that PR added an offline test expecting Pay to be visible offline.

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

    Remove the !isOffline conjunct from the shouldShowPayOption condition at src/hooks/useSearchBulkActions.ts:2077, so the Pay option renders while offline. The existing offline guard in onBulkPaySelected (line 1171) then shows the offline modal on click, matching the expected result — no payment is attempted.

    Add a unit test asserting the Pay option is present in the bulk-action options when isOffline is true, and that selecting it opens the offline modal rather than calling confirmPayment.

    Note on the Hold/Unhold options

    Hold/Unhold use the same !isOffline pattern (lines ~2137, ~2170). Those are intentionally offline-hidden (no offline-modal handler), so this change should be scoped to Pay only — do not blanket-remove !isOffline elsewhere.

    Related issues

    • Expensify/App#95832 — "Cannot Pay reports in bulk, only Mark as Paid even though they have VBA connected" (same bulk-pay dropdown surface; different, online cause). Possibly related, not a duplicate.

    This is a frontend-only change contained in the App repo.


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

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 4, 2026
  6. j3ffffff commented on Aug 4, 2026

    @j3ffffff
  7. melvin-bot commented on Aug 4, 2026

    @melvin-bot

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

  8. melvin-bot commented on Aug 4, 2026

    @melvin-bot
  9. DylanDylann commented on Aug 6, 2026

    @DylanDylann
    Contributor

    @MelvinBot Implement this

  10. MelvinBot commented on Aug 6, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: #97942

    Implemented the approved proposal: removed the !isOffline gate from shouldShowPayOption in src/hooks/useSearchBulkActions.ts so the Pay option renders in the bulk-actions dropdown while offline. Selecting it now hits the existing offline guard in onBulkPaySelected, which shows the offline modal and attempts no payment — matching the expected result. The change is scoped to Pay only; Approve and Hold/Unhold keep their !isOffline gate since they have no offline-modal handler.

    Added a unit test (tests/unit/hooks/useSearchBulkActionsPayTest.ts) asserting Pay is present offline and that selecting it opens the offline modal instead of calling payMoneyRequest. All 70 tests across the useSearchBulkActions suites pass; lint and typecheck are clean.

    Please fill out the Tests/QA sections and mark it as "Ready for review" when it is ready.

  11. added
    ReviewingHas a PR in review
    and removed on Aug 10, 2026
  12. 7 remaining items

  13. melvin-bot commented on Aug 17, 2026

    @melvin-bot

    @DylanDylann Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  14. DylanDylann commented on Aug 18, 2026

    @DylanDylann
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: Not a regression. This is a change request
      Link to the comment on the Issue:

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

    • [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: https://github.com/Expensify/Expensify/issues/674197

    Regression Test Proposal

    Test:

    1. On Search → Reports, select 2+ approved ("Ready to pay") reports.
    2. Go offline.
    3. Open the "N selected" dropdown and verify the Pay option is shown.
    4. Select Pay (or a payment submenu item) and verify the offline modal appears and no payment is attempted.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-c38f-a363-5882-a454f7d91d14
  15. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Aug 20, 2026
  16. melvin-bot commented on Aug 20, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  17. melvin-bot commented on Aug 20, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  18. mallenexpensify commented on Aug 21, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @DylanDylann due $250 via NewDot

  19. quinthar commented on Sep 26, 2026

    @quinthar
    Contributor

    Approved $250 to @DylanDylann

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