Skip to content

best way to save what you love

web/DialogContainer: prevent an error after a race condition

wukko93ff9b62d697
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);
}
};