diff --git a/.changeset/twelve-insects-peel.md b/.changeset/twelve-insects-peel.md new file mode 100644 index 0000000..7b8621f --- /dev/null +++ b/.changeset/twelve-insects-peel.md @@ -0,0 +1,5 @@ +--- +"@simsustech/quasar-components": patch +--- + +fix(FilteredModelSelect): fix fetching of missing modelValue id diff --git a/packages/components/src/ui/form/FilteredModelSelect.vue b/packages/components/src/ui/form/FilteredModelSelect.vue index 22e5f63..d731d1d 100644 --- a/packages/components/src/ui/form/FilteredModelSelect.vue +++ b/packages/components/src/ui/form/FilteredModelSelect.vue @@ -37,7 +37,7 @@ export default { generic="T extends { id: number; [key: string]: unknown }" > import { QSelect } from 'quasar' -import { computed, ref, toRefs, useAttrs, watch, onMounted } from 'vue' +import { computed, ref, toRefs, useAttrs, watch } from 'vue' import { useLang } from './lang/index.js' interface Props { @@ -132,7 +132,7 @@ const filterFn: QSelect['$props']['onFilter'] = (val, update, abort) => { const selectRef = ref() watch(modelValue, () => { - if (!options.value.length) + if (!options.value?.find((val) => val.value === modelValue.value)) emit('filter', { ids: selectedIds.value, searchPhrase: '', @@ -140,12 +140,12 @@ watch(modelValue, () => { }) }) -onMounted(() => { - if (!options.value.length) - emit('filter', { - ids: selectedIds.value, - searchPhrase: '', - done: () => {} - }) -}) +// onMounted(() => { +// if (!options.value?.find((val) => val.value === modelValue.value)) +// emit('filter', { +// ids: selectedIds.value, +// searchPhrase: '', +// done: () => {} +// }) +// })