X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/18bb503b7ba881d9c6b09446e3ecb70eb11fa17e..c0e5f8f04311c22ca8e0be32c1c1da88ae1cceec:/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts?ds=sidebyside diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts index 08b60308..dde622a7 100644 --- a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts +++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts @@ -4,7 +4,7 @@ import { CollectionPanelFilesState, CollectionPanelFile, CollectionPanelDirectory, mapCollectionFileToCollectionPanelFile, mergeCollectionPanelFilesStates } from "./collection-panel-files-state"; import { CollectionPanelFilesAction, collectionPanelFilesAction } from "./collection-panel-files-actions"; -import { createTree, mapTreeValues, getNode, setNode, getNodeAncestors, getNodeDescendants, setNodeValueWith, mapTree } from "~/models/tree"; +import { createTree, mapTreeValues, getNode, setNode, getNodeAncestorsIds, getNodeDescendantsIds, setNodeValueWith, mapTree } from "~/models/tree"; import { CollectionFileType } from "~/models/collection-file"; export const collectionPanelFilesReducer = (state: CollectionPanelFilesState = createTree(), action: CollectionPanelFilesAction) => { @@ -44,7 +44,7 @@ const toggleSelected = (id: string) => (tree: CollectionPanelFilesState) => const toggleDescendants = (id: string) => (tree: CollectionPanelFilesState) => { const node = getNode(id)(tree); if (node && node.value.type === CollectionFileType.DIRECTORY) { - return getNodeDescendants(id)(tree) + return getNodeDescendantsIds(id)(tree) .reduce((newTree, id) => setNodeValueWith(v => ({ ...v, selected: node.value.selected }))(id)(newTree), tree); } @@ -52,7 +52,7 @@ const toggleDescendants = (id: string) => (tree: CollectionPanelFilesState) => { }; const toggleAncestors = (id: string) => (tree: CollectionPanelFilesState) => { - const ancestors = getNodeAncestors(id)(tree).reverse(); + const ancestors = getNodeAncestorsIds(id)(tree).reverse(); return ancestors.reduce((newTree, parent) => parent ? toggleParentNode(parent)(newTree) : newTree, tree); };