Open n3mooo opened 2 months ago
I found the cause and fixed it with the code below
Just checked the value, make sure it's the safe value when insert to the array
Tree
Hello @n3mooo
Thanks for pointing out this issue, if i understand correctly you want to render the proper icon in the Collapse button based on the state of the Tree element, for example : <CloseIcon />
if the Tree is not expended , otherwise a <OpenIcon />
.
And as i see from the first code snippet , you have made some sort of a custom function called renderChildren
for that case.
If you could share with us a codesandbox sample for this bug that you have faced , that would be more helpful , since we don't have enough informations to do the proper fix.
Reproduction link
https://shadcn-extension-landing.vercel.app/docs/tree-view
Steps to reproduce
// ./tree-view-api.tsx
->CollapseButton
Folder
and close, you will see aundefine
value in arrayexpandedItems
stateWhat is expected?
It work properly, the state setExpandedItems should update correctly