fix(search) : disable client-side filtering when server-search is active

SearchSelect was filtering results client-side on label only, hiding
server results matched by reference. Add serverSearch prop to bypass
client filter when the API already handles search.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-24 17:19:13 +01:00
parent 5485bac339
commit 02ca3549d5
6 changed files with 13 additions and 2 deletions

View File

@@ -133,6 +133,10 @@ const props = defineProps({
maxVisible: {
type: Number,
default: 50
},
serverSearch: {
type: Boolean,
default: false
}
})
@@ -150,11 +154,11 @@ const selectedOption = computed(() => {
})
const displayedOptions = computed(() => {
const term = searchTerm.value.trim().toLowerCase()
const items = baseOptions.value.slice()
const filtered = term
const filtered = (!props.serverSearch && searchTerm.value.trim())
? items.filter((option) => {
const term = searchTerm.value.trim().toLowerCase()
const label = resolveLabel(option).toLowerCase()
const description = resolveDescription(option)?.toLowerCase() || ''
return label.includes(term) || description.includes(term)