You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please provide the environment you discovered this bug in.
I'm experiencing an unexpected behavior with a multiple-select component.
After reloading the options, selecting a new option causes the previously selected options to remain selected, instead of clearing out and only selecting the new choice.
Initially, in ngOnInit, the items are bound, and foo is null.
The user selects option 1 and option 2, so foo becomes [1, 2].
The user clicks "click here goto server and update options", and foo resets to [] as expected because the options were reloaded.
Now, if the user tries selecting option 4, the resulting value unexpectedly becomes [1, 2, 4] instead of just [4].
The expected behavior is that only option 4 is selected after reloading the options, but currently, options 1, 2, and 4 all appear selected.
Below is the minimal code to reproduce this issue:
So I noticed that mat-select actually seems to retain the value based on the available options as much as it can.
If exact same options are "updated" then the value remains the same
If there is only a partial update, some same and some different then mat-select seems to just update the value by removing whatever options are no longer available.
If options are completely different values then the value is getting reset
So from what I can tell Spartan Select is currently only matching scenario 3 behavior. Our true fix would be to match scenario 1 and 2 behaviors I believe. @wizardnet972 - let me know what you think, I think this is not quite what you were expecting based on the example you gave. But seems if the options are exact same then we shouldn't be resetting the value.
Please provide the environment you discovered this bug in.
I'm experiencing an unexpected behavior with a multiple-select component.
After reloading the options, selecting a new option causes the previously selected options to remain selected, instead of clearing out and only selecting the new choice.
ngOnInit
, the items are bound, andfoo
isnull
.foo
becomes[1, 2]
.foo
resets to[]
as expected because the options were reloaded.[1, 2, 4]
instead of just[4]
.The expected behavior is that only option 4 is selected after reloading the options, but currently, options 1, 2, and 4 all appear selected.
Below is the minimal code to reproduce this issue:
Which area/package is the issue in?
select
Please provide the exception or error you saw
No response
Other information
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: