From 93ff9b62d6973af4095812bcec93620e419c7587 Mon Sep 17 00:00:00 2001 From: wukko Date: Mon, 17 Mar 2025 16:47:03 +0600 Subject: [PATCH] web/DialogContainer: prevent an error after a race condition an error is no longer thrown if several dialogs were closed while timeout was running this should really be replaced by proper dialog management system, with each dialog having a unique id and removal happening via that id, not just array.pop() --- web/src/components/dialog/DialogContainer.svelte | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/src/components/dialog/DialogContainer.svelte b/web/src/components/dialog/DialogContainer.svelte index 363395ba..dc1bfb76 100644 --- a/web/src/components/dialog/DialogContainer.svelte +++ b/web/src/components/dialog/DialogContainer.svelte @@ -16,9 +16,14 @@ if (dialogParent) { closing = true; open = false; + + // wait 150ms for the closing animation to finish setTimeout(() => { - dialogParent.close(); - killDialog(); + // check if dialog parent is still present + if (dialogParent) { + dialogParent.close(); + killDialog(); + } }, 150); } };