From 9b96459d8a0d6ad80ff063a0865cb17e539cd381 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Thu, 28 Nov 2024 12:35:41 +0100 Subject: [PATCH] simplify --- packages/web/src/components/treeView.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web/src/components/treeView.tsx b/packages/web/src/components/treeView.tsx index d79f522567..242e834ede 100644 --- a/packages/web/src/components/treeView.tsx +++ b/packages/web/src/components/treeView.tsx @@ -319,8 +319,8 @@ function indexTree( selectedItem: T | undefined, expandedItems: Map, autoExpandDepth: number, - isVisible?: (item: T) => boolean): Map { - if (isVisible && !isVisible(rootItem)) + isVisible: (item: T) => boolean = () => true): Map { + if (!isVisible(rootItem)) return new Map(); const result = new Map(); @@ -331,7 +331,7 @@ function indexTree( const appendChildren = (parent: T, depth: number) => { for (const item of parent.children as T[]) { - if (isVisible && !isVisible(item)) + if (!isVisible(item)) continue; const expandState = temporaryExpanded.has(item.id) || expandedItems.get(item.id); const autoExpandMatches = autoExpandDepth > depth && result.size < 25 && expandState !== false;