core-elements icon indicating copy to clipboard operation
core-elements copied to clipboard

Selection broken in core-selection when the selected list is updated with same elements but different order

Open fedy2 opened this issue 11 years ago • 3 comments

I'm updating the selected list passed to core-selector with the same elements but in reverse order, this cause some elements change his state to un-selected.

fedy2 avatar Feb 13 '15 14:02 fedy2

Using JsArray for selected list avoid the issue.

fedy2 avatar Feb 13 '15 14:02 fedy2

Yes, that is unfortunately expected behavior. The only supported way currently of selecting and unselecting items are the selectItem and setItemSelected methods. I didn't realize that it could work to simply modify the list if its a JsArray, but that makes sense. The actual reason this doesn't work is because the js proxies for the items change each time we call jsify, but that is a no-op if its already a JsArray.

jakemac53 avatar Feb 13 '15 14:02 jakemac53

This has come up a few times so I think I will leave this bug open as a reference for people.

I think there is a bug somewhere to use the same instance of the js proxy for a dart object if you call jsify on it multiple times, so once that is fixed then this will no longer be an issue.

jakemac53 avatar Feb 13 '15 14:02 jakemac53