You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Migrate remaining ConfirmModal usages to useConfirmModal #100076
ConfirmModal is deprecated, but origin/main still renders 36 instances across the App codebase. The previous tracker, #76696, covered earlier migration batches and is now deployed.
Solution
Replace the remaining component usages with useConfirmModal, preserving each modal's copy, actions, danger state, focus behavior, and platform-specific behavior. Do not migrate src/components/Modal/Global/ConfirmModalWrapper.tsx as part of the caller inventory; it is the bridge that can be removed after all callers are migrated.
@MelvinBot
Analyze all the modals in the description and check which modals can be migrated and which cannot (for example, by checking comments in the code, why useConfirmModal cannot be used)
32 of 35 can be migrated. 3 cannot without first changing something else. Only one of the three has a written justification in the code today; the other two I found by tracing the call sites.
The one documented blocker, and it checks out. One isVisible spans two steps (loading → complete), the first confirm re-skins the modal and a second confirm follows, and content also repaints from the bulkPolicyCopySettings NVP with no user action. handleConfirm unconditionally hides, and closeModal pops the modal and deletes its promise — the second confirm is unrepresentable. It's also rendered unconditionally from WorkspacesListPage, so there's no imperative call site to hang showConfirmModal() off.
A stable-id "update in place without resolving" path — a multi-resolve/subscription API instead of one-shot Promise.withResolvers.
Three independent problems. (1) hideDeleteModal is exported and called speculatively on unmount from ReportActionItem.tsx:317 even when only the context menu was open — today a harmless no-op, but closeModal() blindly pops the top of the stack and bug-bot-alerts on an empty one. (2) onModalHide nulls reportActionRef.currentsynchronously before the promise resolves, and that ref is exactly what confirmDeleteAndHideModal reads at :379. (3) Both confirm and cancel install different deferred callbackWhenDeleteModalHide callbacks, plus a mid-confirm redirected bail-out.
An id-scoped closeModal(id) that no-ops when that id isn't open, plus a hook to run caller logic before onModalHide.
The component is the config contract — config/types.ts:52 types cancelConfirmation as a component, wired through both scenario configs. Worse, stateReducer.ts force-clears isCancelConfirmVisible in two places with explicit comments ("so it doesn't linger over the outcome screen", "CLOSE_MODAL can close the navigator without the flow ever completing") — declarative auto-hide the one-shot promise can't express. The navigator also returns null at phase === 'closed', unmounting the dialog; a global modal would outlive that.
Change types.ts:52 from a component to a props/config object, then migrate the two call sites separately. Note the AuthorizeTransactionPage call site would be trivially migratable on its own — it's only blocked by sharing the factory.
Mutually exclusive by card state. Workspace twin already migrated at DynamicWorkspaceExpensifyCardDetailsPage.tsx:211. Must drop onBackdropPress — see gotchas.
File already uses showConfirmModal at :252. handleToggle early-returns per branch so none can stack. Keep the isCurrencyModalOpen.current guard on the auto-dismiss effect at :314 so it can't pop a newly-migrated modal. :516's title/body become a snapshot instead of live-updating.
⚠️ Migrate, but not mechanically (18)
Each needs a specific restructure — details per instance
Declarative visibility → needs an effect + ref guard
GPSInProgressModal/index.native.tsx:27 — triggered from a non-React action (libs/actions/HybridApp/index.ts:109), so keep the Onyx flag as the cross-boundary trigger and make this a null-rendering controller (idiom exists in PriorityModeController.tsx:63). Stale-closure risk:getGpsPoints(gpsDraftDetails) would capture points at show time while tracking keeps appending — read via refs.
GPSTripStateChecker/index.native.tsx:145 — closest to blocked. isVisible is a 4-term derived expression; three terms can flip while open and today the modal auto-hides for free. Also onCancel={onViewTrip}stops the trip — collapsing cancel+backdrop into one CLOSE, plus the default shouldHandleNavigationBack: true, would route hardware-back into a destructive action. Pass shouldHandleNavigationBack: false. tests/unit/components/GPSTripStateCheckerTest.tsx will need updating.
ScreenShareRequestModal.tsx:25 — no auto-hide needed (both branches clear the Onyx key), but GlobalModals.tsx:65 documents a DOM-order stacking invariant putting UpdateAppModal on top. Migrating this one alone inverts it — migrate it together with UpdateAppModal.
UnshareBankAccount.tsx:175 — dismissal semantics change. Today onCancel is undefined, so backdrop and ESC are no-ops and the only exit runs clearUnshareBankAccountErrors. After migration CLOSE becomes reachable, so you must clear the errors on bothCONFIRM and CLOSE — otherwise the Onyx error stays set, the effect dep never flips, and the modal can never be re-shown. Needs an isFocused guard too (precedent: DeleteWorkspaceFlow.tsx:139).
Component/hook API ripple
AccountingConnectionConfirmationModal.tsx:22 — single caller (AccountingContext/index.tsx:183), so delete the wrapper and call from startIntegrationFlow. But shouldShowConfirmationModal also gates the renderActiveIntegration() branch — that flag must survive.
useOutstandingBalanceGuard.tsx:41 — the hook returns a React element that is its consumer's entire output (DeleteWorkspaceFlow.tsx:317). Drop it from the return and make that return null; same file already uses showConfirmModal at :145/:206.
WorkspaceWorkflowsPayerPage.tsx:357 & :381 — the RenderHTML prompt's onLinkPress does close-then-navigate. Once local isVisible is gone that callback must call closeModal(), which isn't currently destructured at :99. A real rewrite, not a prop move. (This file proves ReactNode prompts work through the wrapper — :255.)
Chained flows — open the next modal from the resolved promise, not synchronously
index.android.tsx:115, :133, :151 — sequential, never simultaneous, so the top-of-stack rule isn't hit. Native permission prompts move from press-time to one hide-animation later; worth a device pass.
index.ios.tsx:119 & :140 — migration is a net improvement here. The onModalHide ref hack at :93/:112/:135 exists because "can't trigger Precise Location modal before First Ask modal hides / the animations clash". The global promise already resolves after hide, so the ref, the useRef and the onModalHide prop can all be deleted. It also likely fixes a latent bug: onModalHide.current is only assigned after the user answers up to two native dialogs, so if the hide animation finishes first the precise-location modal never appears. Worth confirming on device.
GPSButtons/index.tsx:189 — shown via the child's onDeny, which sits in the child's effect dep array. Fine as-is; re-derive if the child becomes a hook.
UnshareBankAccount.tsx:188 — chains into :175. Safe only in the awaited continuation; pushing it synchronously from onConfirm strands this modal under the next one.
Timing / async
RevokePage.tsx:244 — passes isConfirmLoading, so it takes the wrapper's async branch: the promise resolves but the modal stays open until you call closeModal(). All three hideConfirmModal() calls must become closeModal(). Precedent: DeleteWorkspaceFlow.tsx:212. (Don't copy LockAccountPageBase.tsx:54 — it passes isConfirmLoading and never closes, which looks like a latent leak.)
Five things that bite regardless of which instance you touch
onBackdropPress must be deleted, not forwarded. The wrapper omits only onConfirm/onCancel/isVisible, so onBackdropPress spreads through to BaseModal, which prefers it over onClose. The wrapper's handleCancel then never runs — the modal never hides and the promise never resolves. Affects both ExpensifyCardPage instances (both handlers are byte-identical to onCancel, so dropping them is behavior-preserving).
shouldHandleNavigationBack silently flips undefined → true (useConfirmModal.ts:17). Most instances leave it unset today, so migrating adds a history/back guard. Pass it explicitly where that matters.
A global ENTER shortcut gets registered (ConfirmModalWrapper.tsx:66). For destructive DANGER confirms (delete comment, remove member) that makes Enter a one-keystroke destructive action where it previously wasn't.
closeModal() is not id-scoped — it pops whatever is on top (ModalContext.tsx:111) and bug-bot-alerts on an empty stack. This is the root of the PopoverReportActionContextMenu block and a hazard for every auto-hide conversion.
Props become a snapshot. Anything interpolated into title/prompt from Onyx is captured at show time instead of updating live. Relevant to WorkspaceTravelBillingSection:516 (formattedSpend) and the GPS modals (gpsDraftDetails), where the stale value would be submitted.
Suggested order: the 14 clean ones first (they establish the pattern and shrink the surface), then the 18 with-care ones grouped by theme, and file the 3 blockers as follow-ups — the createCancelConfirmModal and PopoverReportActionContextMenu ones both need a small API change to the global modal system (closeModal(id)) or to the MFA scenario config before they're even in scope.
One caveat: this checkout is a shallow clone, so I couldn't check whether any of these had a migration attempt previously reverted. Worth a quick PR search if any verdict here surprises you.
Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.
Created 6 sub-issues covering the 32 migratable instances, balanced by effort rather than by file count. The 3 blockers from my earlier analysis are deliberately excluded.
All four have declarative visibility, so all four need the same controller-style rewrite. UpdateAppModal and ScreenShareRequestModal must ship together — there's a stacking invariant between them.
Three easy GPSButtons confirms balance out the two hardest instances in the migration (GPSTripStateChecker, GPSInProgressModal).
I weighted each instance 1 for a clean drop-in and 2 for one needing a restructure. Batches came out at 9, 8, 8, 7, 10, 8 — close enough that any of them is a comparable PR.
Excluded (3):CopyPolicySettingsProgressModal, PopoverReportActionContextMenu, and createCancelConfirmModal. Each needs an API change first — an id-scoped closeModal(id), a multi-resolve modal API, or a change to the MFA scenario-config contract. Tell me if you want those filed as follow-ups too; I left them off since they aren't migration work.
Two things I decided rather than guessed, so flag either if you'd rather go the other way:
Labelled them Weekly only, to match this tracker. I didn't add External — making them contributor-eligible triggers the payment flow, which is your call.
Left them unassigned.
Each body carries the per-instance notes, permalinks at 6bf0775, the shared gotchas, and acceptance criteria, so a contributor can pick one up without reading this thread.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Activity
ZhenjaHorbach commentedon Sep 2, 2026
@MelvinBot
Analyze all the modals in the description and check which modals can be migrated and which cannot (for example, by checking comments in the code, why useConfirmModal cannot be used)
MelvinBot commentedon Sep 2, 2026
ConfirmModal migration audit — 35 call-site instances
32 of 35 can be migrated. 3 cannot without first changing something else. Only one of the three has a written justification in the code today; the other two I found by tracing the call sites.
Verdicts are static analysis of
mainat6bf0775.❌ Cannot be migrated as-is (3)
CopyPolicySettingsProgressModal.tsx:151isVisiblespans two steps (loading→complete), the first confirm re-skins the modal and a second confirm follows, and content also repaints from thebulkPolicyCopySettingsNVP with no user action.handleConfirmunconditionally hides, andcloseModalpops the modal and deletes its promise — the second confirm is unrepresentable. It's also rendered unconditionally fromWorkspacesListPage, so there's no imperative call site to hangshowConfirmModal()off.id"update in place without resolving" path — a multi-resolve/subscription API instead of one-shotPromise.withResolvers.PopoverReportActionContextMenu.tsx:540hideDeleteModalis exported and called speculatively on unmount fromReportActionItem.tsx:317even when only the context menu was open — today a harmless no-op, butcloseModal()blindly pops the top of the stack and bug-bot-alerts on an empty one. (2)onModalHidenullsreportActionRef.currentsynchronously before the promise resolves, and that ref is exactly whatconfirmDeleteAndHideModalreads at:379. (3) Both confirm and cancel install different deferredcallbackWhenDeleteModalHidecallbacks, plus a mid-confirmredirectedbail-out.closeModal(id)that no-ops when that id isn't open, plus a hook to run caller logic beforeonModalHide.createCancelConfirmModal.tsx:24config/types.ts:52typescancelConfirmationas a component, wired through both scenario configs. Worse,stateReducer.tsforce-clearsisCancelConfirmVisiblein two places with explicit comments ("so it doesn't linger over the outcome screen", "CLOSE_MODAL can close the navigator without the flow ever completing") — declarative auto-hide the one-shot promise can't express. The navigator also returnsnullatphase === 'closed', unmounting the dialog; a global modal would outlive that.types.ts:52from a component to a props/config object, then migrate the two call sites separately. Note theAuthorizeTransactionPagecall site would be trivially migratable on its own — it's only blocked by sharing the factory.✅ Migrate as-is (14)
Straightforward — user-triggered, confirm/cancel map cleanly onto
CONFIRM/CLOSEUpdateAppModal.tsx:24true, confirm and cancel are the same handler. Cleanest in the set.PreferredWorkspaceToggle.tsx:106SamlLoginSectionContent.tsx:131shouldHandleNavigationBack— zero behavior delta.DynamicIOURequestStepUpgrade.tsx:411IOURequestEditReportCommon.tsx:284.IOURequestEditReportCommon.tsx:398showConfirmModalisn't referentially stable — don't silently drop it from thevalidatePerDiemMovedep array.GPSButtons/index.tsx:181GPSButtons/index.tsx:207ExpenseRulesPage.tsx:214WorkspaceMembersPage.tsx:273.ExpensifyCardPage/index.tsx:709&:721DynamicWorkspaceExpensifyCardDetailsPage.tsx:211. Must droponBackdropPress— see gotchas.DynamicAddNewCardPage.tsx:152WorkspaceTravelBillingSection.tsx:495,:506,:516showConfirmModalat:252.handleToggleearly-returns per branch so none can stack. Keep theisCurrencyModalOpen.currentguard on the auto-dismiss effect at:314so it can't pop a newly-migrated modal.:516's title/body become a snapshot instead of live-updating.Each needs a specific restructure — details per instance
Declarative visibility → needs an effect + ref guard
GPSInProgressModal/index.native.tsx:27— triggered from a non-React action (libs/actions/HybridApp/index.ts:109), so keep the Onyx flag as the cross-boundary trigger and make this a null-rendering controller (idiom exists inPriorityModeController.tsx:63). Stale-closure risk:getGpsPoints(gpsDraftDetails)would capture points at show time while tracking keeps appending — read via refs.GPSTripStateChecker/index.native.tsx:145— closest to blocked.isVisibleis a 4-term derived expression; three terms can flip while open and today the modal auto-hides for free. AlsoonCancel={onViewTrip}stops the trip — collapsing cancel+backdrop into oneCLOSE, plus the defaultshouldHandleNavigationBack: true, would route hardware-back into a destructive action. PassshouldHandleNavigationBack: false.tests/unit/components/GPSTripStateCheckerTest.tsxwill need updating.ScreenShareRequestModal.tsx:25— no auto-hide needed (both branches clear the Onyx key), butGlobalModals.tsx:65documents a DOM-order stacking invariant puttingUpdateAppModalon top. Migrating this one alone inverts it — migrate it together withUpdateAppModal.UnshareBankAccount.tsx:175— dismissal semantics change. TodayonCancelis undefined, so backdrop and ESC are no-ops and the only exit runsclearUnshareBankAccountErrors. After migrationCLOSEbecomes reachable, so you must clear the errors on bothCONFIRMandCLOSE— otherwise the Onyx error stays set, the effect dep never flips, and the modal can never be re-shown. Needs anisFocusedguard too (precedent:DeleteWorkspaceFlow.tsx:139).Component/hook API ripple
AccountingConnectionConfirmationModal.tsx:22— single caller (AccountingContext/index.tsx:183), so delete the wrapper and call fromstartIntegrationFlow. ButshouldShowConfirmationModalalso gates therenderActiveIntegration()branch — that flag must survive.useOutstandingBalanceGuard.tsx:41— the hook returns a React element that is its consumer's entire output (DeleteWorkspaceFlow.tsx:317). Drop it from the return and make thatreturn null; same file already usesshowConfirmModalat:145/:206.WorkspaceWorkflowsPayerPage.tsx:357&:381— theRenderHTMLprompt'sonLinkPressdoes close-then-navigate. Once localisVisibleis gone that callback must callcloseModal(), which isn't currently destructured at:99. A real rewrite, not a prop move. (This file provesReactNodeprompts work through the wrapper —:255.)Chained flows — open the next modal from the resolved promise, not synchronously
index.android.tsx:115,:133,:151— sequential, never simultaneous, so the top-of-stack rule isn't hit. Native permission prompts move from press-time to one hide-animation later; worth a device pass.index.ios.tsx:119&:140— migration is a net improvement here. TheonModalHideref hack at:93/:112/:135exists because "can't trigger Precise Location modal before First Ask modal hides / the animations clash". The global promise already resolves after hide, so the ref, theuseRefand theonModalHideprop can all be deleted. It also likely fixes a latent bug:onModalHide.currentis only assigned after the user answers up to two native dialogs, so if the hide animation finishes first the precise-location modal never appears. Worth confirming on device.GPSButtons/index.tsx:189— shown via the child'sonDeny, which sits in the child's effect dep array. Fine as-is; re-derive if the child becomes a hook.UnshareBankAccount.tsx:188— chains into:175. Safe only in the awaited continuation; pushing it synchronously fromonConfirmstrands this modal under the next one.Timing / async
RevokePage.tsx:244— passesisConfirmLoading, so it takes the wrapper's async branch: the promise resolves but the modal stays open until you callcloseModal(). All threehideConfirmModal()calls must becomecloseModal(). Precedent:DeleteWorkspaceFlow.tsx:212. (Don't copyLockAccountPageBase.tsx:54— it passesisConfirmLoadingand never closes, which looks like a latent leak.)DynamicReportParticipantDetailsPage.tsx:120&DynamicRoomMemberDetailsPage.tsx:113— structurally identical.removeFromGroupChat/removeFromRoom+goBackcurrently fire synchronously on press; after migration they run after the hide animation.Cross-cutting gotchas for whoever picks this up
Five things that bite regardless of which instance you touch
onBackdropPressmust be deleted, not forwarded. The wrapper omits onlyonConfirm/onCancel/isVisible, soonBackdropPressspreads through toBaseModal, which prefers it overonClose. The wrapper'shandleCancelthen never runs — the modal never hides and the promise never resolves. Affects bothExpensifyCardPageinstances (both handlers are byte-identical toonCancel, so dropping them is behavior-preserving).shouldHandleNavigationBacksilently flipsundefined→true(useConfirmModal.ts:17). Most instances leave it unset today, so migrating adds a history/back guard. Pass it explicitly where that matters.ConfirmModalWrapper.tsx:66). For destructiveDANGERconfirms (delete comment, remove member) that makes Enter a one-keystroke destructive action where it previously wasn't.closeModal()is not id-scoped — it pops whatever is on top (ModalContext.tsx:111) and bug-bot-alerts on an empty stack. This is the root of thePopoverReportActionContextMenublock and a hazard for every auto-hide conversion.title/promptfrom Onyx is captured at show time instead of updating live. Relevant toWorkspaceTravelBillingSection:516(formattedSpend) and the GPS modals (gpsDraftDetails), where the stale value would be submitted.Suggested order: the 14 clean ones first (they establish the pattern and shrink the surface), then the 18 with-care ones grouped by theme, and file the 3 blockers as follow-ups — the
createCancelConfirmModalandPopoverReportActionContextMenuones both need a small API change to the global modal system (closeModal(id)) or to the MFA scenario config before they're even in scope.One caveat: this checkout is a shallow clone, so I couldn't check whether any of these had a migration attempt previously reverted. Worth a quick PR search if any verdict here surprises you.
Next Steps: Reply with
@MelvinBot <your feedback>to refine this analysis.view run
ZhenjaHorbach commentedon Sep 2, 2026
@MelvinBot
Can you create 5 or 6 sub-issues for migrating these modals?
With approximately the same migration complexity
MelvinBot commentedon Sep 2, 2026
Created 6 sub-issues covering the 32 migratable instances, balanced by effort rather than by file count. The 3 blockers from my earlier analysis are deliberately excluded.
CONFIRM/CLOSEwith existing precedents. The two remove-member pages are near-identical to each other.showConfirmModal()in-file. Four drop-ins plus twoonLinkPressrewrites.isConfirmLoadingcontract.UpdateAppModalandScreenShareRequestModalmust ship together — there's a stacking invariant between them..android/.ios. Can't be split further; each modal opens from the previous one's outcome.GPSButtonsconfirms balance out the two hardest instances in the migration (GPSTripStateChecker,GPSInProgressModal).I weighted each instance 1 for a clean drop-in and 2 for one needing a restructure. Batches came out at 9, 8, 8, 7, 10, 8 — close enough that any of them is a comparable PR.
Excluded (3):
CopyPolicySettingsProgressModal,PopoverReportActionContextMenu, andcreateCancelConfirmModal. Each needs an API change first — an id-scopedcloseModal(id), a multi-resolve modal API, or a change to the MFA scenario-config contract. Tell me if you want those filed as follow-ups too; I left them off since they aren't migration work.Two things I decided rather than guessed, so flag either if you'd rather go the other way:
Weeklyonly, to match this tracker. I didn't addExternal— making them contributor-eligible triggers the payment flow, which is your call.Each body carries the per-instance notes, permalinks at
6bf0775, the shared gotchas, and acceptance criteria, so a contributor can pick one up without reading this thread.view run
ZhenjaHorbach commentedon Sep 2, 2026
@MelvinBot
Assign me and @roryabraham to these issues
MelvinBot commentedon Sep 2, 2026
Done — you and
roryabrahamare now assigned to all six sub-issues.ZhenjaHorbach,roryabrahamZhenjaHorbach,roryabrahamZhenjaHorbach,roryabrahamZhenjaHorbach,roryabrahamZhenjaHorbach,roryabrahamZhenjaHorbach,roryabrahamVerified after the edits. This tracker already had you both assigned, so I left it alone.
view run
melvin-bot commentedon Sep 25, 2026
This issue has not been updated in over 15 days. @roryabraham, @ZhenjaHorbach eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!