Skip to content

[Due for payment 2026-01-14] Consolidate ConfirmModals into a single, global component #68799

Closed
7 of 7 issues completed

Description

@roryabraham

Coming from https://expensify.slack.com/archives/C05LX9D6E07/p1755561055678639?thread_ts=1755544596.205089&cid=C05LX9D6E07

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.

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. blazejkustra commented on Aug 21, 2025

    @blazejkustra
    Contributor

    Be careful when doing this change @zirgulis, on iOS you might encounter this issue when stacking modals on top of each other.

  2. zirgulis commented on Aug 21, 2025

    @zirgulis
    Contributor

    @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.

  3. blazejkustra commented on Aug 21, 2025

    @blazejkustra
    Contributor

    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 😄

  4. zirgulis commented on Aug 26, 2025

    @zirgulis
    Contributor

    @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.

  5. 110 remaining items

  6. mallenexpensify commented on Jan 16, 2026

    @mallenexpensify
    Contributor

    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

  7. melvin-bot commented on Jan 19, 2026

    @melvin-bot

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

  8. ZhenjaHorbach commented on Jan 20, 2026

    @ZhenjaHorbach
    Contributor

    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

    This is a refactoring issue
    And I'm not sure test cases are needed here
    Since technically nothing has changed

  9. roryabraham commented on Jan 20, 2026

    @roryabraham
    ContributorAuthor

    agree

  10. moved this from AWAITING DEPLOYMENT to Done in [#whatsnext] #qualityon Jan 21, 2026
  11. garrettmknight commented on Jan 21, 2026

    @garrettmknight
    Contributor

    $250 approved for @ZhenjaHorbach

  12. added
    ReviewingHas a PR in review
    and removed on May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ImprovementItem broken or needs improvement.ReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions