show an expand icon for nodes with non-null children arrray (#1862)

This commit is contained in:
Ashley Stanton-Nurse
2024-06-05 12:27:29 -07:00
committed by GitHub
parent 9b12775151
commit 736731474f
3 changed files with 54 additions and 1 deletions

View File

@@ -100,7 +100,8 @@ export const TreeNodeComponent: React.FC<TreeNodeComponentProps> = ({
return unsortedChildren;
};
const isBranch = node.children?.length > 0;
// A branch node is any node with a defined children array, even if the array is empty.
const isBranch = !!node.children;
const onOpenChange = useCallback(
(_: TreeOpenChangeEvent, data: TreeOpenChangeData) => {