Skip to content

Commit

Permalink
Merge pull request #1179 from brave/sync-bookmarks-reducer
Browse files Browse the repository at this point in the history
Handle invisible nodes (Nodes under Pending Bookmarks and itself) in bookmarks reducer
  • Loading branch information
darkdh committed Dec 22, 2018
1 parent 0a68e67 commit 630bb53
Showing 1 changed file with 23 additions and 0 deletions.
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(

0 comments on commit 630bb53

Please sign in to comment.