Skip to content

[Due for payment 2026-10-16] Web - Spend - Floating bar disappear after cancel the Download action #101597

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.84-2
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: #100291
Email or phone of affected tester (no customers): leungbratt6+18095@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Windows 10/Chrome
App Component: Left Hand Navigation (LHN)

Action Performed:

Preconditions: User has a couple of report in the Workspace chat

  1. Open the New Dot app
  2. Navigate to Spend - Report
  3. Select any report
  4. Click Download report on the floating bar
  5. When Download modal processing, cancel it

Expected Result:

The floating bar still displays after cancel the download modal

Actual Result:

The floating bar disappear

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7263261_1789739726863.100291.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7263261

Issue OwnerCurrent Issue Owner: @shubham1206agra

Activity

  1. added
    DeployBlockerCash
    Bug
    on Sep 18, 2026
  2. applause-bot commented on Sep 18, 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/c9bce6467cc623222598b746e89d6b63822a1550051c3cd6787c8a995978927a

  3. melvin-bot commented on Sep 18, 2026

    @melvin-bot

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

  4. github-actions commented on Sep 18, 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. melvin-bot commented on Sep 18, 2026

    @melvin-bot

    @JS00001 @shubham1206agra you have been assigned to this deploy blocker because you reviewed the offending PR: #100291

  6. melvin-bot commented on Sep 18, 2026

    @melvin-bot

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

  7. melvin-bot commented on Sep 18, 2026

    @melvin-bot

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

  8. MelvinBot commented on Sep 18, 2026

    @MelvinBot
    Contributor

    🤖 Deploy blocker verdict: not a regression from Use a floating action bar for bulk actions — recommend demoting and rolling forward. The selection-clearing code that makes the bar vanish is byte-identical on production and has shipped since May. Reverting #100291 would only make the same defect less visible, not fix it.

    Proposal

    What is the root cause of that problem?

    Cancelling the PDF modal runs the same "download finished" cleanup as a successful download, and that cleanup clears the row selection.

    Following the repro path "Spend > Reports → select a report → Download report":

    1. With one report selected, the DOWNLOAD_PDF bulk action does not clear the selection when triggered — it opens the PDF modal (src/hooks/useSearchBulkActions.ts:2648-2668).
    2. While the PDF is still generating, the modal's primary button is Cancel, and it just calls onClose() (src/components/PDFDownloadModal.tsx:128-141).
    3. The modal is wired up with onModalHide only, and no onCancel (src/components/Search/SearchBulkActionsButton.tsx:297-302).
    4. So the hide handler runs on cancel exactly as it does on success, and it unconditionally clears the selection (src/hooks/useSearchBulkActions.ts:3100-3103).
    5. An empty selection collapses the bar: selected drops to 0 (SearchSelectionProvider.tsx:302-306) → useShouldShowBulkActionBar.ts:18-28 returns false → SearchBulkActionsBarWide.tsx:20-22 renders null.

    ReportPDFDownloadModal already knows how to tell cancel apart from completion — it fires onCancel() when dismissed while the filename is still unset (ReportPDFDownloadModal.tsx:59-66). The Search caller simply never passes it, though the MoneyReportHeaderModals.tsx:137 caller does.

    This predates the current release. The offending logic came from feat: Add "Download as PDF" option to Reports page bulk actions dropdown, merged 2026-05-18. #100291 moved the selection UI out of the page header into a floating bar; the mount condition is the same predicate as before, so it changed how conspicuous the symptom is, not the behaviour. On production the same steps clear the checkboxes and collapse the header bulk-action button — same defect, quieter presentation. That means the auto-assignment of Krishna2323, JS00001 and shubham1206agra is misattributed.

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

    In src/hooks/useSearchBulkActions.ts:

    1. Track whether the flow was cancelled with a ref, set by a new handlePdfModalCancel callback and reset where the modal is opened (next to setIsPdfModalVisible(true)).
    2. In handlePdfModalHide, return early without calling clearSelectedTransactions() when that flag is set, then reset it. Nothing was downloaded, so the selection should survive.
    3. Return the new callback from the hook and pass it to ReportPDFDownloadModal as onCancel in SearchBulkActionsButton.tsx — the same prop the MoneyReportHeaderModals caller already uses.

    Keep the clearing on hide rather than moving it to trigger time: the modal renders inside the selection-gated bar and would unmount mid-flight otherwise, which is already noted in a comment at useSearchBulkActions.ts:3107-3110.

    Worth fixing in the same PR: handleExpensifyCardStatementPDFModalHide (useSearchBulkActions.ts:3105-3111) clears the selection on cancel in exactly the same way.

    What alternative solutions did you explore? (Optional)

    Alternatives considered and ruled out

    Revert #100291. Ruled out. Verified against the production blobs that handlePdfModalHide (useSearchBulkActions.ts:3056-3059 on production) and the DOWNLOAD_PDF option are identical there, and that production's SearchBulkActionsButton also wires onModalHide with no onCancel. gh api compare/production...staging shows the only download-related change this release is an added empty-reports guard — nothing touching selection clearing. Reverting restores the old presentation, not correct behaviour.

    Another PR in Deploy Checklist: New Expensify 2026-09-17. Ruled out. Scanned every file changed between production and staging: no other PR in the release touches PDFDownloadModal, ReportPDFDownloadModal, SearchSelectionProvider, or any selection-clearing path. SearchContextDefinitions.ts changed only in an import path.

    The Esc-key shortcut clearing the selection. Considered, because BulkActionBar binds Esc to onClearSelection. Ruled out as a separate cause: that shortcut is gated on !modal?.isVisible (BulkActionBar/index.tsx:88), so it is inactive while the PDF modal is open. Dismissing with Esc still closes the modal and routes through handlePdfModalHide, so it converges on the same root cause and the same fix covers it.

    Confidence: high on the mechanism (call chain read end-to-end) and on #100291 not having introduced it (production blobs fetched and compared directly; blame and the release diff agree). Not verified: a live repro on production — code identity was confirmed, but the app was not run against production, and QA marked production as "N/A".

    💡 Suggested AI code review rule

    This looks like a recurring, mechanically detectable pattern — the identical flaw already exists twice in this one file — so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for Expensify/App:

    • Rule: CLEAN-REACT-PATTERNS-10 — Distinguish cancel from completion in modal dismissal handlers
    • Condition: Flag when a handler passed as onModalHide / onClose / onDismiss performs a completion-only side effect (clearing selection, resetting a form, marking something done, firing analytics) while the modal component declares an onCancel / onSuccess prop the call site does not pass. Wire the specific hook instead, or branch on completion state inside the handler.
    • Why: Dismissal fires on both success and cancel, so success-only cleanup silently runs when the user backs out, discarding work they still expect to have. In this issue that made the bulk action bar vanish after cancelling a download.
    • Search pattern: grep -rn "onModalHide={\|onDismiss={" --include=*.tsx src, then for each hit check whether the target component's props type declares onCancel/onSuccess and whether the call site passes it. In App today that is 46 onModalHide={ call sites, only 7 of them in files that mention onCancel at all.
    • Offending code (❌): useSearchBulkActions.ts:3100-3103
    • Correct pattern (✅): the onCancel contract at ReportPDFDownloadModal.tsx:59-66, wired correctly at MoneyReportHeaderModals.tsx:137

    I checked for overlap and found none: CONSISTENCY-4 covers props declared but unused inside a component, not an available prop a caller ignores, and CLEAN-REACT-PATTERNS-4 covers aggregating unrelated responsibilities. If this is worth adding, a maintainer can open it as a draft PR in Expensify/App.


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


    view run

  9. 46 remaining items

  10. added
    Daily
    Awaiting Payment
    on Oct 15, 2026
  11. melvin-bot commented on Oct 15, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  12. melvin-bot commented on Oct 15, 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
  13. mallenexpensify commented on Oct 18, 2026

    @mallenexpensify
    Contributor

    @shubham1206agra plz complete the Contributor+ checklist and tag me in a post once you have. Thx

  14. added
    Daily
    and removed
    Daily
    on Oct 21, 2026
  15. melvin-bot commented on Oct 28, 2026

    @melvin-bot

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

  16. mallenexpensify commented on Oct 28, 2026

    @mallenexpensify
    Contributor

    @shubham1206agra plz complete the Contributor+ checklist and tag me in a post once you have. Thx

  17. shubham1206agra commented on Oct 29, 2026

    @shubham1206agra
    Contributor

    Contributor+ 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: NA - Result of the original design, single-report PDF download has cleared the selection only after the modal closes since the feature was added, and the design team later asked for it to match the multi-report flow.
      Link to the comment on the Issue: NA - Result of the original design, single-report PDF download has cleared the selection only after the modal closes since the feature was added, and the design team later asked for it to match the multi-report flow.

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

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

    Regression Test Proposal

    Precondition:

    • User has at least two expense reports in a workspace.

    Test:

    1. Go to Spend > Reports.
    2. Select one report using its checkbox.
    3. Click Download report.
    4. Verify that the floating bar disappears and no reports are selected while the "Generate PDF" modal is shown.
    5. Click Cancel before the PDF is ready.
    6. Verify that the floating bar stays hidden and no reports are selected after the modal closes.

    Do we agree 👍 or 👎

  18. mallenexpensify commented on Oct 29, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @Krishna2323 due $250 via NewDot
    Contributor+: @shubham1206agra due $250 via NewDot

    Thx!

  19. laurenreidexpensify commented on Nov 26, 2026

    @laurenreidexpensify
    Contributor

    Approved @Krishna2323 $250 New Expensify

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyEngineeringReviewing

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions