fix(filters): do not fire filter change immediately
Related to https://kolaente.dev/vikunja/vikunja/issues/2194#issuecomment-61081
This commit is contained in:
parent
8c826c44d2
commit
d4605905d3
@ -20,6 +20,7 @@ import {
|
|||||||
getFilterFieldRegexPattern,
|
getFilterFieldRegexPattern,
|
||||||
LABEL_FIELDS,
|
LABEL_FIELDS,
|
||||||
} from '@/helpers/filters'
|
} from '@/helpers/filters'
|
||||||
|
import {useDebounceFn} from '@vueuse/core'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
modelValue,
|
modelValue,
|
||||||
@ -236,6 +237,10 @@ function autocompleteSelect(value) {
|
|||||||
|
|
||||||
autocompleteResults.value = []
|
autocompleteResults.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The blur from the textarea might happen before the replacement after autocomplete select was done.
|
||||||
|
// That caused listeners to try and replace values earlier, resulting in broken queries.
|
||||||
|
const blurDebounced = useDebounceFn(() => emit('blur'), 500)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -264,7 +269,7 @@ function autocompleteSelect(value) {
|
|||||||
@input="handleFieldInput"
|
@input="handleFieldInput"
|
||||||
@focus="onFocusField"
|
@focus="onFocusField"
|
||||||
@keydown="onKeydown"
|
@keydown="onKeydown"
|
||||||
@blur="e => emit('blur', e)"
|
@blur="blurDebounced"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="filter-input-highlight"
|
class="filter-input-highlight"
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</Fancycheckbox>
|
</Fancycheckbox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FilterInputDocs />
|
<FilterInputDocs/>
|
||||||
|
|
||||||
<template
|
<template
|
||||||
v-if="hasFooter"
|
v-if="hasFooter"
|
||||||
@ -59,8 +59,8 @@ import {useProjectStore} from '@/stores/projects'
|
|||||||
import {FILTER_OPERATORS, transformFilterStringForApi, transformFilterStringFromApi} from '@/helpers/filters'
|
import {FILTER_OPERATORS, transformFilterStringForApi, transformFilterStringFromApi} from '@/helpers/filters'
|
||||||
import FilterInputDocs from '@/components/project/partials/FilterInputDocs.vue'
|
import FilterInputDocs from '@/components/project/partials/FilterInputDocs.vue'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
hasTitle= false,
|
hasTitle = false,
|
||||||
hasFooter = true,
|
hasFooter = true,
|
||||||
modelValue,
|
modelValue,
|
||||||
} = defineProps<{
|
} = defineProps<{
|
||||||
@ -110,7 +110,15 @@ function change() {
|
|||||||
const filter = transformFilterStringForApi(
|
const filter = transformFilterStringForApi(
|
||||||
params.value.filter,
|
params.value.filter,
|
||||||
labelTitle => labelStore.filterLabelsByQuery([], labelTitle)[0]?.id || null,
|
labelTitle => labelStore.filterLabelsByQuery([], labelTitle)[0]?.id || null,
|
||||||
projectTitle => projectStore.searchProject(projectTitle)[0]?.id || null,
|
projectTitle => {
|
||||||
|
const found = projectStore.findProjectByExactname(projectTitle)
|
||||||
|
|
||||||
|
if (found === null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return found[0]?.id || null
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
let s = ''
|
let s = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user