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
[Due for payment 2026-01-14] Consolidate ConfirmModals into a single, global component #68799
Proposal: Consolidate confirm modals into a single, global component.
Background
Expensify's user interface relies heavily on confirmation dialogs for critical actions like deleting transactions, approving expenses, and exporting reports. A maximum of one ConfirmModal should be visible at any given time. Currently, each component that needs a confirmation dialog mounts its own ConfirmModal component in the JSX tree, even when that modal is not visible, creating component tree bloat with dozens of modal components existing simultaneously. Each confirmation flow requires developers to manage dedicated state variables, define separate callback functions, and coordinate between triggering components and modals.
Some components that use ConfirmModal have more complex multi-step confirmation flows, and each of those are implemented individually within the components that render ConfirmModal as well.
Problem
When every component mounts its own ConfirmModal in the component tree, it creates component bloat, memory overhead from multiple modal instances, and repetitive boilerplate code that makes the application harder to maintain.
Solution
Lift a single ConfirmModal instance up in the component tree so that it can be shared across the app. Child components can use context to show and hide the shared ConfirmModal with whatever props they want to pass to it. Internally, the state of the ConfirmModal is a stack (allowing for multi-step confirmations, one of our UI requirements), and that state is managed through React Context.
@blazejkustra thanks for the heads up, will keep an eye on this. I don't think this should be the problem since here we only display a single modal at the time, i.e. modals do not overlap on top of each other. We only "stack" the modals in regards to their state.
That makes sense, but Confirm modal might be triggered from another modal, and that's when you might encounter this issue. Either way, just a heads up 😄
Activity
blazejkustra commentedon Aug 21, 2025
Be careful when doing this change @zirgulis, on iOS you might encounter this issue when stacking modals on top of each other.
zirgulis commentedon Aug 21, 2025
@blazejkustra thanks for the heads up, will keep an eye on this. I don't think this should be the problem since here we only display a single modal at the time, i.e. modals do not overlap on top of each other. We only "stack" the modals in regards to their state.
blazejkustra commentedon Aug 21, 2025
That makes sense, but Confirm modal might be triggered from another modal, and that's when you might encounter this issue. Either way, just a heads up 😄
zirgulis commentedon Aug 26, 2025
@roryabraham @mountiny the initial PR is ready for review #68190
As @roryabraham mentioned here we can definitely get some help from the community to get this task split into smaller PRs.
Happy to lead the initiative and help to review PR's.
110 remaining items
mallenexpensify commentedon Jan 16, 2026
Payment Summary
Contributor+: @ZhenjaHorbach due $250 via NewDot
@ZhenjaHorbach plz complete the BZ checklist.
Also.. I'm assuming we're good to close this after the checklist and test case
melvin-bot commentedon Jan 19, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
ZhenjaHorbach commentedon Jan 20, 2026
This is a refactoring issue
And I'm not sure test cases are needed here
Since technically nothing has changed
roryabraham commentedon Jan 20, 2026
agree
garrettmknight commentedon Jan 21, 2026
$250 approved for @ZhenjaHorbach