Chromium Code Reviews| Index: chrome/browser/resources/md_bookmarks/router.js |
| diff --git a/chrome/browser/resources/md_bookmarks/router.js b/chrome/browser/resources/md_bookmarks/router.js |
| index 2634fb32157b391a9bdafe884a755c145204af6e..01e34e646be521755d023d81b1bba869e83f52a1 100644 |
| --- a/chrome/browser/resources/md_bookmarks/router.js |
| +++ b/chrome/browser/resources/md_bookmarks/router.js |
| @@ -30,8 +30,7 @@ Polymer({ |
| }, |
| observers: [ |
| - 'onQueryChanged_(queryParams_.q)', |
| - 'onFolderChanged_(queryParams_.id)', |
| + 'onQueryParamsChanged_(queryParams_)', |
| 'onStateChanged_(searchTerm_, selectedId_)', |
| ], |
| @@ -46,17 +45,17 @@ Polymer({ |
| }, |
| /** @private */ |
| - onQueryChanged_: function() { |
| + onQueryParamsChanged_: function() { |
| var searchTerm = this.queryParams_.q || ''; |
| - if (searchTerm && searchTerm != this.searchTerm_) { |
| + var selectedId = this.queryParams_.id; |
| + if (!selectedId && !searchTerm) |
| + selectedId = BOOKMARKS_BAR_ID; |
| + |
| + if (searchTerm != (this.searchTerm_ || '')) { |
|
calamity
2017/07/05 04:04:38
This is a wild line.
tsergeant
2017/07/05 07:37:36
Fixed. The OR case was only used during startup wh
|
| this.searchTerm_ = searchTerm; |
| this.dispatch(bookmarks.actions.setSearchTerm(searchTerm)); |
| } |
| - }, |
| - /** @private */ |
| - onFolderChanged_: function() { |
| - var selectedId = this.queryParams_.id; |
| if (selectedId && selectedId != this.selectedId_) { |
| this.selectedId_ = selectedId; |
| // Need to dispatch a deferred action so that during page load |
| @@ -77,7 +76,9 @@ Polymer({ |
| updateQueryParams_: function() { |
| if (this.searchTerm_) |
| this.queryParams_ = {q: this.searchTerm_}; |
| - else |
| + else if (this.selectedId_ != BOOKMARKS_BAR_ID) |
| this.queryParams_ = {id: this.selectedId_}; |
| + else |
| + this.queryParams_ = {}; |
| }, |
| }); |