Skip to content

[Due for payment 2026-09-17] [Batch 1] Refactor ConfirmModal usage to useConfirmModal in simple user-triggered confirms (7 modals) #100151

Closed

Description

@MelvinBot

Part of #100076.

Problem

ConfirmModal is deprecated. These seven call sites are the simplest of the remaining inventory — every one is triggered by a discrete user action and its confirm/cancel handlers map cleanly onto the CONFIRM / CLOSE actions returned by showConfirmModal().

Modals in this batch

Instance Notes
src/pages/domain/Groups/PreferredWorkspaceToggle.tsx:106 Informational; confirm and cancel are the same handler and shouldShowCancelButton={false}. The promise result can be ignored entirely.
src/pages/domain/Saml/SamlLoginSectionContent.tsx:131 Already passes shouldHandleNavigationBack, so there is zero delta on that prop. buttonVariant: DANGER spreads through the wrapper.
src/pages/iou/request/step/DynamicIOURequestStepUpgrade.tsx:411 Acknowledgement-only. Identical prop shape to the already-migrated call at IOURequestEditReportCommon.tsx:284. The isUpgradeWarningModalOpen state and its handler become dead code.
src/pages/iou/request/step/IOURequestEditReportCommon.tsx:398 Same file already migrated one call. showConfirmModal is not referentially stable — don't silently drop it from the validatePerDiemMove useCallback dep array.
src/pages/settings/Rules/ExpenseRulesPage.tsx:214 Near-identical migrated precedent at WorkspaceMembersPage.tsx:273 — same bulk-selection dropdown, same shouldSkipFocusRestore: true. Note the effect at :55 clears selectedRules on Onyx change; the .then() closure will hold the pre-open selection.
src/pages/DynamicReportParticipantDetailsPage.tsx:120 removeFromGroupChat + Navigation.goBack() currently fire synchronously on press; after migration they run after the hide animation.
src/pages/DynamicRoomMemberDetailsPage.tsx:113 Structurally identical to the row above (removeFromRoom + goBack). Migrate both together.

Shared gotchas

These apply to every batch of this migration — full write-up in this analysis.

  1. Delete onBackdropPress, never forward it. The wrapper omits only onConfirm/onCancel/isVisible, so onBackdropPress spreads to BaseModal, which prefers it over onClose — handleCancel then never runs, the modal never hides, and the promise never resolves.
  2. shouldHandleNavigationBack silently flips undefined → true (useConfirmModal.ts:17). Pass it explicitly where the old behavior matters.
  3. A global ENTER shortcut gets registered (ConfirmModalWrapper.tsx:66). For the two DANGER remove-member modals in this batch, that makes Enter a one-keystroke destructive confirm where it previously wasn't.
  4. closeModal() is not id-scoped — it pops whatever is on top of the stack.
  5. Props become a snapshot taken at show time, not a live-updating binding.

Acceptance criteria

  • All seven instances use useConfirmModal(); no ConfirmModal import remains in these files.
  • Confirm, cancel, backdrop, focus-management and navigation behavior are unchanged.
  • Existing relevant tests pass; coverage added or updated where needed.
Issue OwnerCurrent Issue Owner: @ZhenjaHorbach

Activity

  1. ZhenjaHorbach commented on Sep 3, 2026

    @ZhenjaHorbach
    Contributor

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

  2. MelvinBot commented on Sep 3, 2026

    @MelvinBot
    ContributorAuthor

    Draft PR created: #100285 — all seven modals migrated. Please mark it "Ready for review" when it's ready.

    Each site swaps a declarative <ConfirmModal isVisible={...}> plus its useState flag for an imperative showConfirmModal() call in the handler that used to flip that flag. config/eslint/eslint.seatbelt.tsv drops the seven now-resolved no-deprecated/ConfirmModal entries.

    Three things worth your review:

    1. shouldHandleNavigationBack is left at the hook's default (true) for the six sites that never passed it. This is a real delta — browser back now dismisses the dialog instead of navigating away. I went this way rather than pinning false because the global modal is rendered by ModalProvider and outlives the page that opened it, so false would leave an orphaned dialog on top of the next screen. It also matches the already-migrated acknowledgement modal at IOURequestEditReportCommon.tsx:284, which the issue cites as the precedent for DynamicIOURequestStepUpgrade. Say the word if you'd rather have strict prop-for-prop preservation.
    2. ExpenseRulesPage captures the selection at show time. As the issue predicted, the .then() closure holds the pre-open selection. handleDeleteRules now takes the rule list as a parameter to make that explicit rather than implicit.
    3. The ENTER shortcut on the two DANGER remove-member dialogs. Enter is now a one-keystroke destructive confirm where it previously wasn't. That's inherent to ConfirmModalWrapper and consistent with the already-migrated WorkspaceMembersPage remove-members dialog, but it is a behavior change.

    No onBackdropPress existed on any of the seven, so that hazard didn't apply.

    Checks run locally: typecheck, lint-changed, spell-changed, and react-compiler-compliance-check all pass. tests/ui/IOURequestEditReportCommonTest.tsx is the only suite in the repo touching any of these seven files — 7/7 pass, including one case I added asserting the per diem move warning goes through showConfirmModal and that selectReport isn't called.

    Browser verification did not run. The CI web session came up on a blank page (0 DOM nodes, no network activity) and couldn't be recovered without a reload, which the harness forbids. That looks like test-infra rather than these changes — the dev server had already compiled three of the touched routes — but I couldn't confirm it either way. The manual Tests / QA sections still need a human pass, so please click through the confirm/cancel paths before marking ready.


    view run

  3. melvin-bot commented on Sep 8, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  4. changed the title [-][Batch 1] Refactor ConfirmModal usage to useConfirmModal in simple user-triggered confirms (7 modals)[/-] [+][Due for payment 2026-09-17] [Batch 1] Refactor ConfirmModal usage to useConfirmModal in simple user-triggered confirms (7 modals)[/+] on Sep 10, 2026
  5. melvin-bot commented on Sep 10, 2026

    @melvin-bot

    @ZhenjaHorbach

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.75-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-09-17. 🎊

    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]

  6. ZhenjaHorbach commented on Sep 14, 2026

    @ZhenjaHorbach
    Contributor

    @roryabraham
    Let's close this
    I think we can handle the payment in the parent issue

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