fix empty popups

This commit is contained in:
2025-11-10 14:24:38 +01:00
parent 1d9488e6dd
commit 93b035159b
3 changed files with 16 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
import { onDestroy } from 'svelte';
interface Props {
end: Date,
end: Date;
}
let { end }: Props = $props();

View File

@@ -5,16 +5,22 @@
// html bindings
let modal: HTMLDialogElement;
// state
let closeTimeoutId = $state(-1);
// lifecycle
const cancel = confirmPopupState.subscribe((value) => {
if (value) modal.show();
if (!value) return;
clearTimeout(closeTimeoutId);
modal.show();
});
onDestroy(cancel);
// callbacks
function onModalClose() {
setTimeout(() => ($confirmPopupState = null), 300);
closeTimeoutId = setTimeout(() => ($confirmPopupState = null), 300);
}
</script>

View File

@@ -5,9 +5,15 @@
// html bindings
let modal: HTMLDialogElement;
// state
let closeTimeoutId = $state(-1);
// lifecycle
const cancel = popupState.subscribe((value) => {
if (value) modal.show();
if (!value) return;
clearTimeout(closeTimeoutId);
modal.show();
});
onDestroy(cancel);