mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-30 03:38:54 +01:00
fix(InputMenu/SelectMenu): prevent double filter with async search
Resolves #1966
This commit is contained in:
@@ -391,7 +391,7 @@ export default defineComponent({
|
|||||||
const debouncedSearch = props.search && typeof props.search === 'function' ? useDebounceFn(props.search, props.debounce) : undefined
|
const debouncedSearch = props.search && typeof props.search === 'function' ? useDebounceFn(props.search, props.debounce) : undefined
|
||||||
|
|
||||||
const options = computedAsync(async () => {
|
const options = computedAsync(async () => {
|
||||||
if (props.search && debouncedSearch) {
|
if (debouncedSearch) {
|
||||||
return await debouncedSearch(query.value)
|
return await debouncedSearch(query.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +401,7 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const filteredOptions = computed(() => {
|
const filteredOptions = computed(() => {
|
||||||
if (!query.value) {
|
if (!query.value || debouncedSearch) {
|
||||||
return options.value
|
return options.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ export default defineComponent({
|
|||||||
const debouncedSearch = props.searchable && typeof props.searchable === 'function' ? useDebounceFn(props.searchable, props.debounce) : undefined
|
const debouncedSearch = props.searchable && typeof props.searchable === 'function' ? useDebounceFn(props.searchable, props.debounce) : undefined
|
||||||
|
|
||||||
const options = computedAsync(async () => {
|
const options = computedAsync(async () => {
|
||||||
if (props.searchable && debouncedSearch) {
|
if (debouncedSearch) {
|
||||||
return await debouncedSearch(query.value)
|
return await debouncedSearch(query.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +464,7 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const filteredOptions = computed(() => {
|
const filteredOptions = computed(() => {
|
||||||
if (!query.value) {
|
if (!query.value || debouncedSearch) {
|
||||||
return options.value
|
return options.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user