fix(filters): do not fire filter change immediately
continuous-integration/drone/push Build is failing Details

Related to #2194 (comment)
This commit is contained in:
kolaente 2024-03-13 19:58:24 +01:00
parent 8c826c44d2
commit d4605905d3
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 18 additions and 5 deletions

View File

@ -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"

View File

@ -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 = ''