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

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

Issue 2812493002: MD Bookmarks: Restore any previously selected folder when clearing search (Closed)
Patch Set: Fix comment 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/util.js
diff --git a/chrome/browser/resources/md_bookmarks/util.js b/chrome/browser/resources/md_bookmarks/util.js
index a8e70f05ac6bcec86189b8e146f55061a610c8e9..c6e4c001bb3dd5a383d57a152a4e86442ab91797 100644
--- a/chrome/browser/resources/md_bookmarks/util.js
+++ b/chrome/browser/resources/md_bookmarks/util.js
@@ -8,12 +8,14 @@
cr.define('bookmarks.util', function() {
/**
+ * Returns the list of bookmark IDs to be displayed in the UI, taking into
+ * account search and the currently selected folder.
* @param {!BookmarksPageState} state
* @return {!Array<string>}
*/
function getDisplayedList(state) {
if (!isShowingSearch(state))
- return assert(state.nodes[assert(state.selectedFolder)].children);
+ return assert(state.nodes[state.selectedFolder].children);
return state.search.results;
}
@@ -82,10 +84,10 @@ cr.define('bookmarks.util', function() {
/**
* @param {BookmarksPageState} state
- * @return boolean
+ * @return {boolean}
*/
function isShowingSearch(state) {
- return !state.selectedFolder;
+ return !!state.search.term && !state.search.inProgress;
}
/**
« no previous file with comments | « chrome/browser/resources/md_bookmarks/types.js ('k') | chrome/test/data/webui/md_bookmarks/reducers_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698