Chromium Code Reviews| Index: chrome/browser/resources/md_history/history_list.js |
| diff --git a/chrome/browser/resources/md_history/history_list.js b/chrome/browser/resources/md_history/history_list.js |
| index aaba6536622c5929aba6360e9ff38e4a8f659dfc..30c56aca28317562606f471a48f56f27abc09cfa 100644 |
| --- a/chrome/browser/resources/md_history/history_list.js |
| +++ b/chrome/browser/resources/md_history/history_list.js |
| @@ -16,6 +16,11 @@ Polymer({ |
| querying: Boolean, |
| + reloadingList_: { |
| + type: Boolean, |
| + value: false, |
| + }, |
| + |
| // An array of history entries in reverse chronological order. |
| historyData_: Array, |
| @@ -81,10 +86,23 @@ Polymer({ |
| } |
| if (this.historyData_) { |
| - // If we have previously received data, push the new items onto the |
| - // existing array. |
| - results.unshift('historyData_'); |
| - this.push.apply(this, results); |
| + // Reload the list when browsing data is cleared. |
| + if (this.reloadingList_) { |
| + this.reloadingList_ = false; |
| + // If we have previously received data, refresh the list unless the user |
| + // has any items checked. |
| + var selectedItem = this.historyData_.filter(function(item) { |
|
tsergeant
2016/08/08 05:05:12
Chris has a CL in review which makes it much easie
|
| + return item.selected; |
| + }); |
| + if (selectedItem.length == 0) { |
| + this.splice('historyData_', 0, this.historyData_.length); |
| + this.set('historyData_', results); |
| + } |
| + } else { |
| + // Infinite scrolling. Push the new items onto the existing array. |
| + results.unshift('historyData_'); |
| + this.push.apply(this, results); |
| + } |
| } else { |
| // The first time we receive data, use set() to ensure the iron-list is |
| // initialized correctly. |
| @@ -92,6 +110,10 @@ Polymer({ |
| } |
| }, |
| + reloadingList: function() { |
| + this.reloadingList_ = true; |
| + }, |
| + |
| /** |
| * Cycle through each entry in historyData_ and set all items to be |
| * unselected. |