Commit f647cad
committed
Fix setValue incorrectly assuming there is a change when there is none
When using the component with multiple set to true and there are no option selected, the setValue call will incorrectly assume there is a change (and trigger a change event) because jquery val method returns null instead of an empty array.
This can trigger an infinite loop if you have a controlled component where the state of the host component is synchronized with the selected elements (hosting component will receive the change, update its state and then send the updated state = [] to the component)
Fix consist in checking if the select is in multiple mode and if so, ensuring we return an empty array in case there is no option selected.1 parent 8acc158 commit f647cad
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
0 commit comments