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

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

Issue 2813503002: MD Bookmarks: Prevent navigating to invalid folders (Closed)
Patch Set: handleAction -> dispatch Created 3 years, 8 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
« no previous file with comments | « chrome/browser/resources/md_bookmarks/reducers.js ('k') | chrome/browser/resources/md_bookmarks/store.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11d1d40104c5a4cc6d9409b5f11687d5b9715b6c..2634fb32157b391a9bdafe884a755c145204af6e 100644
--- a/chrome/browser/resources/md_bookmarks/router.js
+++ b/chrome/browser/resources/md_bookmarks/router.js
@@ -42,6 +42,7 @@ Polymer({
this.watch('searchTerm_', function(state) {
return state.search.term;
});
+ this.updateFromStore();
},
/** @private */
@@ -58,7 +59,12 @@ Polymer({
var selectedId = this.queryParams_.id;
if (selectedId && selectedId != this.selectedId_) {
this.selectedId_ = selectedId;
- this.dispatch(bookmarks.actions.selectFolder(selectedId));
+ // Need to dispatch a deferred action so that during page load
+ // `this.getState()` will only evaluate after the Store is initialized.
+ this.dispatchAsync(function(dispatch) {
+ dispatch(
+ bookmarks.actions.selectFolder(selectedId, this.getState().nodes));
+ }.bind(this));
}
},
« no previous file with comments | « chrome/browser/resources/md_bookmarks/reducers.js ('k') | chrome/browser/resources/md_bookmarks/store.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698