about summary refs log tree commit diff
path: root/src/components/Dialog/index.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-04-26 23:42:49 -0700
committerGitHub <noreply@github.com>2024-04-27 07:42:49 +0100
commit61d7e6014b13bbb53046d84867cc37daf944198f (patch)
treebd5dc17467589612f407a4eb2995a502c27729e4 /src/components/Dialog/index.tsx
parent7eb1444f2c82cd25a77445b82178b7299e8452c7 (diff)
downloadvoidsky-61d7e6014b13bbb53046d84867cc37daf944198f.tar.zst
ensure dialog is closed on unmount (#3650)
Revert "properly check if the ref is null"

This reverts commit 8f563808a5d39389b0bc47a31e73cd147d1e7e8b.

properly check if the ref is null

ensure dialog is closed on unmount
Diffstat (limited to 'src/components/Dialog/index.tsx')
-rw-r--r--src/components/Dialog/index.tsx6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx
index 859e4965c..e5a6792db 100644
--- a/src/components/Dialog/index.tsx
+++ b/src/components/Dialog/index.tsx
@@ -152,6 +152,12 @@ export function Outer({
     [open, close],
   )
 
+  React.useEffect(() => {
+    return () => {
+      setDialogIsOpen(control.id, false)
+    }
+  }, [control.id, setDialogIsOpen])
+
   const context = React.useMemo(() => ({close}), [close])
 
   return (