Skip to content

Commit

Permalink
fix dom-repeat sort on item update
Browse files Browse the repository at this point in the history
Fixes Polymer#3626 by triggering a render when a single item changes in a
sorted/filtered dom-repeat.
  • Loading branch information
43081j committed May 1, 2016
1 parent 409ad83 commit a277ad5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/lib/template/dom-repeat.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,31 @@
} else { // items.*
// slice off 'items.' ('items.'.length == 6)
var subpath = change.path.slice(6);
this._checkItemChanges(subpath);
this._forwardItemPath(subpath, change.value);
this._checkObservedPaths(subpath);
}
},

_checkItemChanges: function(path) {
var paths = path.split('.');
if (paths[0] === 'length') {
return;
}
if(this._sortFn || this._filterFn) {
// if an entire item has changed
if(paths.length === 1 && paths[0].indexOf('#') === 0) {
this._needFullRefresh = true;
if (this.delay) {
this.debounce('render', this._render, this.delay);
} else {
this._debounceTemplate(this._render);
}
return;
}
}
},

_checkObservedPaths: function(path) {
if (this._observePaths) {
path = path.substring(path.indexOf('.') + 1);
Expand Down

0 comments on commit a277ad5

Please sign in to comment.