From c48a3da3b39e2178a266337fdb11a28670d5271e Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Tue, 23 Sep 2025 12:59:22 +0200 Subject: [PATCH] missing $derived and $state => reactivity issue when switching between DynSelect and DynMultiselect --- frontend/src/lib/components/DynamicInput.svelte | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/lib/components/DynamicInput.svelte b/frontend/src/lib/components/DynamicInput.svelte index 2eab6d77be..289641a94a 100644 --- a/frontend/src/lib/components/DynamicInput.svelte +++ b/frontend/src/lib/components/DynamicInput.svelte @@ -36,14 +36,16 @@ let { value = $bindable(), helperScript, format, otherArgs: otherArgs }: Props = $props() - const [inputType, entrypoint] = format.includes('-') ? format.split('-', 2) : [format, ''] + let [inputType, entrypoint] = $derived(format.includes('-') ? format.split('-', 2) : [format, '']) - const isMultiple = inputType === 'dynmultiselect' - const isSelect = inputType === 'dynselect' || inputType === 'dynmultiselect' + let isMultiple = $derived(inputType === 'dynmultiselect') + let isSelect = $derived(inputType === 'dynselect' || inputType === 'dynmultiselect') - if (isMultiple && value === undefined) { - value = [] - } + $effect(() => { + if (isMultiple && value === undefined) { + value = [] + } + }) let resultJobLoader: JobLoader | undefined = $state() let _items = usePromise(getItemsFromOptions, { clearValueOnRefresh: false })