Skip to content

"Pay" appears offline for bulk selected expenses in report #87671

Closed as not planned

Description

@nlemma

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.58-1
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: #85796 Test 9, step 5
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: MacBook Air 15.7.4 Chrome, iPhone 15 iOS 26.3.1
App Component: Money Requests

Action Performed:

  1. Sign in to ND
  2. Create a workspace, create a report with 2-3 expenses
  3. Go offline
  4. Open an expense report, long-press to enter selection mode, select all expenses
  5. Click Submit, select all the expenses again and click Approve
  6. Select all the expenses and verify Pay does not appear

Expected Result:

"Pay" does not appear for bulk selected expenses in offline mode

Actual Result:

"Pay" appears for bulk selected expenses 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

Bug7126906_1775837845288.Pay_appears_offline.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 Apr 10, 2026
  2. melvin-bot commented on Apr 10, 2026

    @melvin-bot

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

  3. melvin-bot commented on Apr 10, 2026

    @melvin-bot

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

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

    @roryabraham
    Contributor

    Where do the expected steps come from? Is there some reason bulk-paying expense reports is not expected to be supported offline?

  6. OSBotify commented on Apr 10, 2026

    @OSBotify
    Contributor

    Investigation Summary - Classification: Frontend bug. Causing PR: #85796 by @Krishna2323 (High confidence). Title: Add selection mode Submit/Approve/Pay actions for mobile layout. Recommendation: REVERT. PR 85796 introduced selection mode Submit/Approve/Pay actions for mobile layout and contains a logic error causing Pay to appear while offline. Reverting will immediately fix the issue since this is a new feature not yet in production. Assigned: @Krishna2323 (PR author), @situchan (approving reviewer), @puneetlath (approving reviewer). Labels: DeployBlockerCash is correctly applied - no label changes needed. Root cause: The bug is in src/hooks/useSelectionModeReportActions.ts at line 509. The offline guard is: hasPayAction AND NOT (isOffline AND NOT canAllowSettlement). This only hides Pay when BOTH isOffline is true AND canAllowSettlement is false. Since canAllowSettlement is computed from hasUpdatedTotal(report, policy) and can return true even while offline (it checks if the report total is up to date, not network connectivity), Pay renders in offline mode whenever the report has a valid total. The expected behavior per QA step 9 of the PR itself is that Pay should not appear when offline. The fix should use a direct isOffline check to unconditionally hide Pay when offline.

  7. MelvinBot commented on Apr 10, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The selection mode bulk action menus use the condition hasPayAction && !(isOffline && !canAllowSettlement) to decide whether to show "Pay" (useSelectionModeReportActions.ts:509, MoneyReportHeader.tsx:1222). This simplifies to "show Pay when online, OR when offline if canAllowSettlement is true." Since canAllowSettlement (hasUpdatedTotal) returns true for most reports (it only returns false for edge cases like pending cross-currency transactions), Pay appears in the selection mode dropdown even when offline — particularly after optimistic Submit → Approve transitions, where the report state appears "approved" locally despite the server never having confirmed it.

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

    Change the condition in both locations from:

    hasPayAction && !(isOffline && !canAllowSettlement) → hasPayAction && !isOffline

    This hides the Pay action entirely when offline in selection mode. The two locations are:

    • src/hooks/useSelectionModeReportActions.ts:509 (mobile/narrow layout)
    • src/components/MoneyReportHeader.tsx:1222 (wide/desktop layout)

    What alternative solutions did you explore? (Optional)

    An alternative would be to check whether the report has pending optimistic actions (e.g., a pendingAction on the report from submit/approve) and only hide Pay in that case. However, the simpler approach of hiding Pay entirely when offline in selection mode matches the expected behavior described in the issue and is consistent with how the search bulk actions handle this (useSearchBulkActions.ts:1173 already uses !isOffline as a hard gate for Pay).


    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.

  8. roryabraham commented on Apr 10, 2026

    @roryabraham
    Contributor

    looks like the expected steps come from the QA steps in the PR: #85796

  9. roryabraham commented on Apr 10, 2026

    @roryabraham
    Contributor

    Coming from https://expensify.slack.com/archives/C01GTK53T8Q/p1775849232466899, this is expected behavior. closing as not planned

  10. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Apr 10, 2026
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.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions