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.
This commit is contained in:
parent
0c5b4c756f
commit
27c4720328
1 changed files with 3 additions and 3 deletions
|
@ -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]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue