Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6792)

Unified Diff: chrome/browser/resources/md_bookmarks/router.js

Issue 2960143002: MD Bookmarks: Remove '/?id=1' from URL when displaying Bookmarks Bar (Closed)
Patch Set: Tweak logic to remove extra dispatch, add tests Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_ = {};
},
});

Powered by Google App Engine
This is Rietveld 408576698