Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dom-repeat filter not updating when entire Array item is set #3254

Closed
stevenjb opened this issue Dec 30, 2015 · 3 comments · Fixed by #4942
Closed

dom-repeat filter not updating when entire Array item is set #3254

stevenjb opened this issue Dec 30, 2015 · 3 comments · Fixed by #4942
Assignees
Milestone

Comments

@stevenjb
Copy link

Summary:

 <template is="dom-repeat" filter="aFilter" observe="show" items="{{items}}">
        <div>{{item.name}}</div>
    </template>

  properties: {  items: { type: Array, value: function() { return [ 
        {show: false, name: 'A'}, 
        {show: true, name: 'B'}, 
      ]}
  }

This updates the dom-repeat as expected:

this.set('items.0.show', true);

This however does not update the dom-repeat, although I would expect it to:

  var newItem = { show: true, name: 'A' };
  this.set('items.0', newItem);

As a workaround I am using splice, which works as expected:

this.splice('items', 0, 1, newItem);

Fiddle: https://jsfiddle.net/stevenjb_chromium/nbndnsk7/

@zoechi
Copy link

zoechi commented Dec 30, 2015

When you enclose code blocks in triple backticks source code becomes more readable (single backtick for inline code)

@ebidel
Copy link
Contributor

ebidel commented Dec 31, 2015

@kevinpschaaf is this expected. I would expect this to work as well, but splice is also a proper "workaround".

@kevinpschaaf kevinpschaaf added the p1 label Jan 4, 2016
@kevinpschaaf kevinpschaaf self-assigned this Jan 4, 2016
@kevinpschaaf
Copy link
Member

Confirmed this is a bug with the observe handling when replacing items. Marking as bug.

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

Successfully merging a pull request may close this issue.

6 participants