| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Module of functions which produce a new page state in response | 6 * @fileoverview Module of functions which produce a new page state in response |
| 7 * to an action. Reducers (in the same sense as Array.prototype.reduce) must be | 7 * to an action. Reducers (in the same sense as Array.prototype.reduce) must be |
| 8 * pure functions: they must not modify existing state objects, or make any API | 8 * pure functions: they must not modify existing state objects, or make any API |
| 9 * calls. | 9 * calls. |
| 10 */ | 10 */ |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 if (!nodes[action.id].children) | 400 if (!nodes[action.id].children) |
| 401 return closedFolders; | 401 return closedFolders; |
| 402 | 402 |
| 403 return ClosedFolderState.openFolderAndAncestors( | 403 return ClosedFolderState.openFolderAndAncestors( |
| 404 closedFolders, action.parentId, nodes); | 404 closedFolders, action.parentId, nodes); |
| 405 case 'remove-bookmark': | 405 case 'remove-bookmark': |
| 406 return bookmarks.util.removeIdsFromSet( | 406 return bookmarks.util.removeIdsFromSet( |
| 407 closedFolders, action.descendants); | 407 closedFolders, action.descendants); |
| 408 default: | 408 default: |
| 409 return closedFolders; | 409 return closedFolders; |
| 410 }; | 410 } |
| 411 }; | 411 }; |
| 412 | 412 |
| 413 /** | 413 /** |
| 414 * Root reducer for the Bookmarks page. This is called by the store in | 414 * Root reducer for the Bookmarks page. This is called by the store in |
| 415 * response to an action, and the return value is used to update the UI. | 415 * response to an action, and the return value is used to update the UI. |
| 416 * @param {!BookmarksPageState} state | 416 * @param {!BookmarksPageState} state |
| 417 * @param {Action} action | 417 * @param {Action} action |
| 418 * @return {!BookmarksPageState} | 418 * @return {!BookmarksPageState} |
| 419 */ | 419 */ |
| 420 function reduceAction(state, action) { | 420 function reduceAction(state, action) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 431 | 431 |
| 432 return { | 432 return { |
| 433 reduceAction: reduceAction, | 433 reduceAction: reduceAction, |
| 434 ClosedFolderState: ClosedFolderState, | 434 ClosedFolderState: ClosedFolderState, |
| 435 NodeState: NodeState, | 435 NodeState: NodeState, |
| 436 SearchState: SearchState, | 436 SearchState: SearchState, |
| 437 SelectedFolderState: SelectedFolderState, | 437 SelectedFolderState: SelectedFolderState, |
| 438 SelectionState: SelectionState, | 438 SelectionState: SelectionState, |
| 439 }; | 439 }; |
| 440 }); | 440 }); |
| OLD | NEW |