fix: initialize multiselect state in modal component

This commit is contained in:
2026-02-01 16:52:30 -05:00
parent 755b356d61
commit 908441de4b
@@ -43,6 +43,7 @@
let reportType = ''; let reportType = '';
let reportInitialized = false; let reportInitialized = false;
let reportLoading = false; let reportLoading = false;
let multiselectInitialized = false;
let turnstileEl: HTMLDivElement | null = null; let turnstileEl: HTMLDivElement | null = null;
let turnstileWidgetId: string | null = null; let turnstileWidgetId: string | null = null;
@@ -85,6 +86,13 @@
initializeReport(); initializeReport();
} }
$: if (show && mode === 'multiselect' && !multiselectInitialized) {
multiselectInitialized = true;
inputValue = Array.isArray(initialValue)
? JSON.parse(JSON.stringify(initialValue))
: [];
}
function resetModal() { function resetModal() {
inputValue = inputValue =
initialValue !== null initialValue !== null
@@ -102,6 +110,7 @@
reportType = ''; reportType = '';
reportInitialized = false; reportInitialized = false;
reportLoading = false; reportLoading = false;
multiselectInitialized = false;
if (turnstileWidgetId && typeof window !== 'undefined' && window.turnstile?.remove) { if (turnstileWidgetId && typeof window !== 'undefined' && window.turnstile?.remove) {
window.turnstile.remove(turnstileWidgetId); window.turnstile.remove(turnstileWidgetId);
} }