PolymerElements / iron-selector

Manages a list of elements that can be selected
32 stars 55 forks source link

items not updated when selectable is changed #126

Open globits opened 8 years ago

globits commented 8 years ago

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

bicknellr commented 8 years ago

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

MarcMouallem commented 7 years ago

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 commented 7 years ago

@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.

globits commented 7 years ago

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 commented 7 years ago

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