Unmount Dialog children when closed
CI / build-image (push) Successful in 38s
CI / check (push) Successful in 2m50s

The native <dialog> wrapper rendered its children unconditionally
and only called dialog.close() on the underlying element when
open went false. The React subtree stayed mounted, so component
state (e.g. a ConfirmButton mid-confirm with a red checkmark
showing) survived a close/reopen cycle and reappeared the next
time the user opened the same dialog.

Gate children on open so the subtree unmounts on close. Next open
gets a fresh tree with default state.
This commit is contained in:
Lukas
2026-06-19 16:52:17 +02:00
parent 934d98025e
commit a045e3a0f9
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ export function Dialog({ open, onClose, className, children }: DialogProps) {
className,
)}
>
<div className="p-6">{children}</div>
{open ? <div className="p-6">{children}</div> : null}
</dialog>
);
}