Problem:
The same modal can be opened multiple times and stack on top of itself:
ModalLayout.openModal has no guard against duplicates — if two callers
(double-click, race, effect re-run) call openModal("x") before the first
instance closes, two instances of x are pushed into activeModals.
useCommitmentGuard's effect re-runs while walletClient.account && !commitment && !isAuthenticated stays true, firing
openModal("generateCommitment") repeatedly and producing overlapping
generate-commitment modals.
Expectation:
- At most one modal instance per modal name is active at a time; repeated
openModal(sameName) calls are no-ops while an instance is already open.
- Guard hooks fire
openModal once per eligibility transition and reset after
the user becomes ineligible (commitment created, logged in, or wallet
disconnected).
Problem:
The same modal can be opened multiple times and stack on top of itself:
ModalLayout.openModalhas no guard against duplicates — if two callers(double-click, race, effect re-run) call
openModal("x")before the firstinstance closes, two instances of
xare pushed intoactiveModals.useCommitmentGuard's effect re-runs whilewalletClient.account && !commitment && !isAuthenticatedstays true, firingopenModal("generateCommitment")repeatedly and producing overlappinggenerate-commitment modals.
Expectation:
openModal(sameName)calls are no-ops while an instance is already open.openModalonce per eligibility transition and reset afterthe user becomes ineligible (commitment created, logged in, or wallet
disconnected).