Commit 34ef4e67 authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

Downloads WebUI: skip updating entries when there are no new entries

Bug: 923274
Change-Id: I98b7a42fd02ec0a950074265f4bf0c992ecc9b08
Reviewed-on: https://chromium-review.googlesource.com/c/1427739
Auto-Submit: Esmael El-Moslimany <aee@chromium.org>
Reviewed-by: default avatarDan Beam (slow until 1/29) <dbeam@chromium.org>
Commit-Queue: Esmael El-Moslimany <aee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625284}
parent 5bc17745
...@@ -126,15 +126,17 @@ cr.define('downloads', function() { ...@@ -126,15 +126,17 @@ cr.define('downloads', function() {
*/ */
insertItems_: function(index, items) { insertItems_: function(index, items) {
// Insert |items| at the given |index| via Array#splice(). // Insert |items| at the given |index| via Array#splice().
this.items_.splice.apply(this.items_, [index, 0].concat(items)); if (items.length > 0) {
this.updateHideDates_(index, index + items.length); this.items_.splice.apply(this.items_, [index, 0].concat(items));
this.notifySplices('items_', [{ this.updateHideDates_(index, index + items.length);
index: index, this.notifySplices('items_', [{
addedCount: items.length, index: index,
object: this.items_, addedCount: items.length,
type: 'splice', object: this.items_,
removed: [], type: 'splice',
}]); removed: [],
}]);
}
if (this.hasAttribute('loading')) { if (this.hasAttribute('loading')) {
this.removeAttribute('loading'); this.removeAttribute('loading');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment