missing $derived and $state => reactivity issue when switching between DynSelect and DynMultiselect

This commit is contained in:
Diego Imbert
2025-09-23 12:59:22 +02:00
parent ac918a84b6
commit c48a3da3b3

View File

@@ -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 })