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,
LABEL_FIELDS,
} from '@/helpers/filters'
import {useDebounceFn} from '@vueuse/core'
const {
modelValue,
@ -236,6 +237,10 @@ function autocompleteSelect(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>
<template>
@ -264,7 +269,7 @@ function autocompleteSelect(value) {
@input="handleFieldInput"
@focus="onFocusField"
@keydown="onKeydown"
@blur="e => emit('blur', e)"
@blur="blurDebounced"
/>
<div
class="filter-input-highlight"

View File

@ -110,7 +110,15 @@ function change() {
const filter = transformFilterStringForApi(
params.value.filter,
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 = ''