Harvest-Dev / ng-select2

A select2 for Angular
MIT License
55 stars 32 forks source link

updateValue called per item (and then the array of the value is all the time 1 bigger) when we set the value (through "code") #38

Closed jcompagner closed 1 year ago

jcompagner commented 2 years ago

When we change the value of:

[value]="value"

and it is already an array of lets say 3 items ['a', 'b', 'c']

our updateValue is called 3 times...

first with ['a'] then with ['a', 'b'] then with ['a','b','c'] (and so on)

So our code thinks the first time, ok the value is changed (the user changed the value) to only 1 then it thinks its 2 and so on...

Which is for us quite annoying, i expect that updateValue() is only called when a user makes a change (not when it is changed through code), and if that is hard todo, then i at least expect it to be called once with the full array (then we can see "oh there is no change", but now we think it is directly changed)

see the stack what i see in the browser, this is hit 3 times 1 per item and the array is all the time 1 bigger.

image