16583: Add "Intermediate" to collection type filters
[arvados-workbench2.git] / src / models / tree.ts
index 69224059b88dc8277d0d31345d088f846bbcfc25..e92913887a0dfc7b28e21ae20b047dc68d61f148 100644 (file)
@@ -16,7 +16,6 @@ export interface TreeNode<T = any> {
     selected: boolean;
     expanded: boolean;
     status: TreeNodeStatus;
-    level?: number;
 }
 
 export enum TreeNodeStatus {
@@ -75,6 +74,7 @@ export const setNodeValueWith = <T>(mapFn: (value: T) => T) => (id: string) => (
 export const mapTreeValues = <T, R>(mapFn: (value: T) => R) => (tree: Tree<T>): Tree<R> =>
     getNodeDescendantsIds('')(tree)
         .map(id => getNode(id)(tree))
+        .filter(node => !!node)
         .map(mapNodeValue(mapFn))
         .reduce((newTree, node) => setNode(node)(newTree), createTree<R>());
 
@@ -194,7 +194,6 @@ export const initTreeNode = <T>(data: Pick<TreeNode<T>, 'id' | 'value'> & { pare
     expanded: false,
     status: TreeNodeStatus.INITIAL,
     parent: '',
-    level: 0,
     ...data,
 });