Skip to content

[Due for payment 2026-10-23] [$175] [Batch 2] Refactor DecisionModal usage to useDecisionModal in Search bulk actions and SelectionToolbar alerts (5 modals) #102976

Closed

Description

@MelvinBot

Part of #80285.

Problem

Search bulk actions and the report selection toolbar each mount their own one-button DecisionModal alerts. These modals should use the global useDecisionModal instead. Each change is mechanical. Most of the work is in the large useSearchBulkActions hook and its tests.

Modals in this batch

Instance Notes
src/components/Search/SearchBulkActionsButton.tsx:277 "Offline". State lives in useSearchBulkActions.ts:614 and is set at about 14 sites. Keep the deferModalPresentationAfterPopoverDismiss wrapper at L1494.
src/components/Search/SearchBulkActionsButton.tsx:286 "Download failed". The prompt reads emptyReportsCount, which is only reset at L1188, so the prompt can be stale. Pass an explicit prompt at each call site: downloadFailedEmptyReportDescription with a count, or downloadFailedDescription.
src/components/Search/SearchBulkActionsButton.tsx:311 "Expensify Card statement PDF: one feed at a time". It has one trigger, in exportExpensifyCardStatementPDF.
src/components/MoneyRequestReportView/SelectionToolbar/index.tsx:309 "Download failed" from onExportFailed. This also fixes a bug. On wide layouts the toolbar unmounts after a CSV export starts (useSelectedTransactionsActions.ts:446), so the inline modal never appears when the export fails.
src/components/MoneyRequestReportView/SelectionToolbar/index.tsx:318 "Offline". The text is the same as the already-migrated version in MoneyReportHeaderModals.tsx:71-77.

Code to remove

  • In useSearchBulkActions: the visibility state (L614, 615, 620, 628), the close handlers (L3239-3245, L3260-3262), and the related return fields.
  • In SelectionToolbar: the offlineModalVisible and isDownloadErrorModalVisible state (L95-96). Leave the ProcessMoneyReportHoldMenu block in this file to Batch 3.

Tests to update

These tests assert on hook visibility state. Switch them to mocking useDecisionModal, the way useExportActionsTest.ts:51-54 does.

  • tests/unit/hooks/useSearchBulkActionsPayTest.ts
  • tests/unit/hooks/useSearchBulkActionsDownloadReceiptsTest.ts
  • tests/unit/hooks/useSearchBulkActionsDownloadPDFTest.ts
  • tests/unit/hooks/useSearchBulkActionsExportTest.ts
  • tests/unit/Search/SearchBulkActionsButtonTest.tsx, which mocks emptyReportsCount

Shared gotchas

  1. shouldHandleNavigationBack flips from undefined to true, so browser Back now closes these alerts.
  2. Props become a snapshot taken at show time, so pass the prompt explicitly.
  3. Some alerts open while a popover is still closing. Already-migrated useExportActions does the same, so keep the existing defer wrapper and check iOS.

Acceptance criteria

  • All five instances use useDecisionModal(), and no DecisionModal import remains in SearchBulkActionsButton.tsx.
  • The "Download failed" prompt is correct at every trigger site.
  • In SelectionToolbar, the CSV-export failure alert appears on wide layouts.
  • Existing relevant tests pass. Add or update coverage where needed.
Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @ZhenjaHorbach

Activity

  1. melvin-bot commented on Oct 8, 2026

    @melvin-bot

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

  2. ZhenjaHorbach commented on Oct 9, 2026

    @ZhenjaHorbach
    Contributor

    @MelvinBot
    Create the PR to migrate all modals from the issue description

  3. MelvinBot commented on Oct 9, 2026

    @MelvinBot
    ContributorAuthor

    🤖 Draft PR created: Use useDecisionModal for Search bulk actions and SelectionToolbar alerts
    Please mark it as "Ready for review" or ask me to do that for you when it is ready for review.

    All five alerts now open through useDecisionModal(), and SearchBulkActionsButton.tsx no longer imports DecisionModal.

    • Each "Download failed" trigger now passes its own prompt, so the stale empty-report text can't appear.
    • The bulk-pay offline alert still uses the deferModalPresentationAfterPopoverDismiss wrapper.
    • The SelectionToolbar CSV-export failure alert no longer depends on the toolbar staying mounted, so it shows on wide layouts.

    Checks: Typecheck passed. The five affected Jest suites passed (114 tests), including a new test for the empty-report prompt. ESLint found no new errors. I did not run the full Jest suite or the Storybook smoke test.

    Not verified in the app: The test browser session was blank, so I couldn't click through the alerts. Please test on all platforms, especially iOS, where some alerts open while a popover is still closing.

    I couldn't push to your fork, so the branch is on upstream. The PR has a comment with the commands to move it to your fork.

  4. melvin-bot commented on Oct 12, 2026

    @melvin-bot

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

  5. ZhenjaHorbach commented on Oct 13, 2026

    @ZhenjaHorbach
    Contributor

    Not overdue
    Try to complete reviewing the PR today

  6. changed the title [-][Batch 2] Refactor DecisionModal usage to useDecisionModal in Search bulk actions and SelectionToolbar alerts (5 modals)[/-] [+][$175] [Batch 2] Refactor DecisionModal usage to useDecisionModal in Search bulk actions and SelectionToolbar alerts (5 modals)[/+] on Oct 14, 2026
  7. melvin-bot commented on Oct 14, 2026

    @melvin-bot
  8. changed the title [-][$175] [Batch 2] Refactor DecisionModal usage to useDecisionModal in Search bulk actions and SelectionToolbar alerts (5 modals)[/-] [+][Due for payment 2026-10-23] [$175] [Batch 2] Refactor DecisionModal usage to useDecisionModal in Search bulk actions and SelectionToolbar alerts (5 modals)[/+] on Oct 16, 2026
  9. melvin-bot commented on Oct 16, 2026

    @melvin-bot

    @ZhenjaHorbach

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.12-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-10-23. 🎊

    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]

  10. melvin-bot commented on Oct 19, 2026

    @melvin-bot

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

  11. ZhenjaHorbach commented on Oct 20, 2026

    @ZhenjaHorbach
    Contributor

    @roryabraham
    Let's close this!

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions