From 0344104d7b66d03a7294d192a863f06ff5abccd7 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 21 Mar 2024 11:22:11 -0500 Subject: [PATCH] Improve close logic --- src/state/dialogs/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/state/dialogs/index.tsx b/src/state/dialogs/index.tsx index 0baf99174c..26bb6792fd 100644 --- a/src/state/dialogs/index.tsx +++ b/src/state/dialogs/index.tsx @@ -54,7 +54,10 @@ export function Provider({children}: React.PropsWithChildren<{}>) { >('auto') const closeAllDialogs = React.useCallback(() => { - activeDialogs.current.forEach(dialog => dialog.current.close()) + openDialogs.current.forEach(id => { + const dialog = activeDialogs.current.get(id) + if (dialog) dialog.current.close() + }) return openDialogs.current.size > 0 }, [])