iron-selector icon indicating copy to clipboard operation
iron-selector copied to clipboard

items not updated when selectable is changed

Open globits opened this issue 9 years ago • 5 comments

The items property is not updated when selectable property changes

Expected outcome

items and selectedItem properties are updated when selectable change.

Actual outcome

items array and selectedItem are not updated when selectable change.

Steps to reproduce

  1. Set up selectable property.
  2. Check items array length.
  3. Change selectable property.
  4. Check items array length.

Test Case

http://jsbin.com/qacariqucu/edit?html,js,output

globits avatar Jun 22 '16 17:06 globits

The test case you provided seems to work. Are you seeing different values for numItems and expectedItems? (Maybe I don't understand the issue?)

bicknellr avatar Jul 14 '16 22:07 bicknellr

I solved this issue myself by adding '_updateItems(selectable)' to the observers array in iron-selectable. An official fix would be nice, please! Just a note, this issue only occurs when the value for selectable is changed after iron-selectable is attached.

The issue is that _updateItems() is only called upon attachment and adding and removing items, and is not called again when the value of selectable is changed.

If you want me to create a pull request I can, but it's just a one line fix; refer to first line of comment.

MarcMouallem avatar Dec 07 '16 06:12 MarcMouallem

@bicknellr Any update on wether the Polymer team is going to fix this issue? Also, looks like my previous suggestion is incomplete as you would also have to _updateSelected() if you should.

MarcMouallem avatar Dec 13 '16 11:12 MarcMouallem

Thats exactly the problem, there`s a PR already on https://github.com/PolymerElements/iron-selector/pull/127 , fell free to update it if necessary.

globits avatar Feb 15 '17 16:02 globits

Please, check an updated PR regarding this issue on https://github.com/PolymerElements/iron-selector/pull/149

globits avatar Mar 13 '17 15:03 globits