Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle invisible nodes (Nodes under Pending Bookmarks and itself) in bookmarks reducer #1179

Merged
merged 1 commit into from
Dec 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions patches/chrome-browser-resources-md_bookmarks-reducers.js.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/chrome/browser/resources/md_bookmarks/reducers.js b/chrome/browser/resources/md_bookmarks/reducers.js
index 17ca9e18c8f4635aac2db849cb77886a4c7390dc..184e2f993812d6da4e09890336b2815e86d563f0 100644
--- a/chrome/browser/resources/md_bookmarks/reducers.js
+++ b/chrome/browser/resources/md_bookmarks/reducers.js
@@ -240,6 +240,9 @@ cr.define('bookmarks', function() {
NodeState.moveBookmark = function(nodes, action) {
const nodeModifications = {};
const id = action.id;
+ // Skip when new/old parent is invisible (Pending Bookmarks)
+ if (!nodes[action.oldParentId] || !nodes[action.parentId])
+ return nodes;

// Change node's parent.
nodeModifications[id] =
@@ -414,7 +417,7 @@ cr.define('bookmarks', function() {
return FolderOpenState.openFolderAndAncestors(
folderOpenState, nodes[action.id].parentId, nodes);
case 'move-bookmark':
- if (!nodes[action.id].children)
+ if (!nodes[action.id] || !nodes[action.id].children)
return folderOpenState;

return FolderOpenState.openFolderAndAncestors(