Skip to content

Commit 7b85cd7

Browse files
committed
If a tree node is missing, estimate the size as zero
1 parent ceabfba commit 7b85cd7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/webapp/app/components/primitives/TreeView/TreeView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,11 @@ export function useTree<TData, TFilterValue>({
235235
getItemKey: (index) => state.visibleNodeIds[index],
236236
getScrollElement: () => parentRef.current,
237237
estimateSize: (index: number) => {
238+
const treeItem = tree[index];
239+
if (!treeItem) return 0;
238240
return estimatedRowHeight({
239-
node: tree[index],
240-
state: state.nodes[tree[index].id],
241+
node: treeItem,
242+
state: state.nodes[treeItem.id],
241243
index,
242244
});
243245
},

0 commit comments

Comments
 (0)