File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import { faCheck as fasCheck } from '@fortawesome/free-solid-svg-icons'
19
19
import { faXmark as fasXmark } from ' @fortawesome/free-solid-svg-icons'
20
20
import NeBadge from ' ./NeBadge.vue'
21
21
import { onClickOutside } from ' @vueuse/core'
22
- import { uniqBy } from ' lodash-es'
22
+ import { uniqBy , isEqual } from ' lodash-es'
23
23
24
24
export interface NeComboboxOption {
25
25
id: string
@@ -165,8 +165,9 @@ onMounted(() => {
165
165
watch (
166
166
() => props .modelValue ,
167
167
() => {
168
- // watching modelValue with multiple selection causes a loop that degrades rendering performance
169
- if (! props .multiple ) {
168
+ if (props .multiple ) {
169
+ selectMultipleOptionsFromModelValue ()
170
+ } else {
170
171
selectSingleOptionFromModelValue ()
171
172
}
172
173
}
@@ -260,7 +261,11 @@ function selectMultipleOptionsFromModelValue() {
260
261
selectedList .push (optionFound )
261
262
}
262
263
}
263
- selected .value = selectedList
264
+
265
+ // update selected list only if needed: this is needed to avoid loops that degrade performances
266
+ if (! isEqual (selected .value , selectedList )) {
267
+ selected .value = selectedList
268
+ }
264
269
}
265
270
266
271
function focus() {
You can’t perform that action at this time.
0 commit comments