From 27c4720328adccf58fd923885b2aa6107c6d5ca3 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 29 Jun 2025 20:26:32 +0200 Subject: [PATCH] Fix changes not being detected in SelectDropdown When modifying the set instead of replacing it with a new set the change detection logic in Vue.js doesn't properly propagate the change, causing certain computed properties that depend on them to go stale. Fix by creating a new set here, which will emit a modelValue:update event which will propagate through the v-model bindings. --- components/SelectDropdown.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/SelectDropdown.vue b/components/SelectDropdown.vue index fb67d24..0e40e82 100644 --- a/components/SelectDropdown.vue +++ b/components/SelectDropdown.vue @@ -163,7 +163,7 @@ function keyBackspace(event: KeyboardEvent) { return; } if (props.multi) { - selectedIds.value.delete(lastId); + selectedIds.value = new Set(selectedIds.value).difference(new Set([lastId])); } else { selectedIds.value = new Set(); } @@ -175,9 +175,9 @@ function toggleActive(event: MouseEvent | KeyboardEvent) { if (activeId.value !== undefined) { if (props.multi) { if (selectedIds.value.has(activeId.value)) { - selectedIds.value.delete(activeId.value); + selectedIds.value = new Set(selectedIds.value).difference(new Set([activeId.value])); } else { - selectedIds.value.add(activeId.value); + selectedIds.value = new Set(selectedIds.value).union(new Set([activeId.value])); } } else { selectedIds.value = new Set([activeId.value]);