fix empty popups
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { onDestroy } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
end: Date,
|
||||
end: Date;
|
||||
}
|
||||
|
||||
let { end }: Props = $props();
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user