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

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

Issue 2813503002: MD Bookmarks: Prevent navigating to invalid folders (Closed)
Patch Set: Rebase & Implement deferred actions 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
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..d215bb2b366028fc9b2875c6acf2ca0c494016cd 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.dispatch(function(dispatch) {
+ dispatch(
+ bookmarks.actions.selectFolder(selectedId, this.getState().nodes));
+ }.bind(this));
calamity 2017/05/02 08:27:15 So... If I understand correctly, the deferred acti
tsergeant 2017/05/03 02:57:31 Yup, that's the idea.
}
},

Powered by Google App Engine
This is Rietveld 408576698