From 61d7e6014b13bbb53046d84867cc37daf944198f Mon Sep 17 00:00:00 2001
From: Hailey <me@haileyok.com>
Date: Fri, 26 Apr 2024 23:42:49 -0700
Subject: 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
---
 src/components/Dialog/index.tsx | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'src/components/Dialog/index.tsx')

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 (
-- 
cgit 1.4.1

