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 }, [])