Skip to content

Commit 98b98c6

Browse files
committed
feat: 🎸 added doesChangeAffectFlattenedTree to getFlattenedTree
1 parent a8f8f49 commit 98b98c6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/selectors/getFlattenedTree.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const isNodeExpanded = node => node.state && node.state.expanded;
2-
const nodeHasChildren = node => node.children && node.children.length;
1+
export const isNodeExpanded = node => node.state && node.state.expanded;
2+
export const nodeHasChildren = node => node.children && node.children.length;
33

44
export const getFlattenedTree = (nodes, parents = []) =>
55
nodes.reduce((flattenedTree, node) => {
@@ -29,3 +29,7 @@ export const getFlattenedTreePaths = (nodes, parents = []) => {
2929

3030
return paths;
3131
};
32+
33+
export const doesChangeAffectFlattenedTree = (previousNode, nextNode) => {
34+
return isNodeExpanded(previousNode) !== isNodeExpanded(nextNode);
35+
};

0 commit comments

Comments
 (0)