fix: multiselect clear button now properly clears the value (#2067)

Fixes #2045
This commit is contained in:
kolaente
2026-01-08 15:16:03 +01:00
committed by GitHub
parent 6c7a800bf4
commit 909b35ea76
3 changed files with 16 additions and 5 deletions

View File

@@ -321,6 +321,13 @@ function handleFocus() {
function select(object: T | null) {
if (object === null) {
// Handle clearing the value
if (!props.multiple) {
internalValue.value = null
query.value = ''
emit('update:modelValue', null)
closeSearchResults()
}
return
}

View File

@@ -6,7 +6,7 @@
label="title"
:select-placeholder="$t('project.searchSelect')"
:model-value="project"
@update:modelValue="Object.assign(project, $event)"
@update:modelValue="(val) => val === null ? select(null) : Object.assign(project, val)"
@select="select"
@search="findProjects"
>

View File

@@ -546,12 +546,16 @@ function useAvailableTimezones(settingsRef: Ref<IUserSettings>) {
}
const timezoneObject = computed({
get: () => ({
value: settingsRef.value.timezone,
label: settingsRef.value.timezone?.replace(/_/g, ' '),
get: () => ({
value: settingsRef.value.timezone,
label: settingsRef.value.timezone?.replace(/_/g, ' '),
}),
set: (obj) => {
if (obj && typeof obj === 'object' && 'value' in obj) {
if (obj === null) {
settingsRef.value.timezone = ''
return
}
if (typeof obj === 'object' && 'value' in obj) {
settingsRef.value.timezone = obj.value
}
},