-
Notifications
You must be signed in to change notification settings - Fork 868
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1179 from brave/sync-bookmarks-reducer
Handle invisible nodes (Nodes under Pending Bookmarks and itself) in bookmarks reducer
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
patches/chrome-browser-resources-md_bookmarks-reducers.js.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |