Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

_observeItems not called when item # doesn't change #156

Open
7 tasks
deto opened this issue Jun 22, 2017 · 1 comment
Open
7 tasks

_observeItems not called when item # doesn't change #156

deto opened this issue Jun 22, 2017 · 1 comment

Comments

@deto
Copy link

deto commented Jun 22, 2017

Description

I have a <template is="dom-repeat"> inside of an <iron-selector> (actually a <paper-listbox>). If I change the items inside the "dom-repeat" to a new Array, but the new Array has the same number of items as the old Array, the selection doesn't update.

I believe that I have tracked this down to _observeItems (or rather, the callback defined inside it), not firing in this situation.

I ran into this while implementing a cascaded dropdown, whereby the selection in one paper-dropdown-menu influenced the item list in the second.

This is on the latest 1.x iron-selector and Polymer component set so I'm not sure if this has been fixed already in 2.0

Expected outcome

When changing the nodes under iron-selector, _observeItems is run and "iron-items-changed" is fired, even if the list has the same number of elements as before.

Actual outcome

My second paper-menu-dropdown is showing the same selection as before since 'iron-items-changed' never fired.

Live Demo

Steps to reproduce

Create this:

<paper-listbox>
    <template is="dom-repeat" items="[[myItems]]">
        <paper-item data-index$="[[item.Index]]">[[item.Name]]</paper-item>
    </template>
</paper-listbox>

Set this.myItems to [{ Index: 1, Name: 'XX'}] and "iron-items-changed" is fired as expected.

Now set this.myItems to [{ Index: 2, Name: 'YY'}] and "iron-items-changed" is not fired.

Browsers Affected

  • [X ] Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10
@haoruiqian
Copy link

Any updates on this issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants