Closed khamphou closed 1 year ago
Hi, I just had a look, and there seems to be some issues with closures in your code. Replace the onExpandItem
and onCollapseItem
props with
onExpandItem={(item) => {
console.log("expand", item);
setExpandedItems((items) => [...items, item?.index]);
}}
onCollapseItem={(item) =>
setExpandedItems((items) =>
items.filter((expandedItemIndex) => expandedItemIndex !== item?.index)
)
}
Then it works: https://codesandbox.io/s/react-complex-tree-expandall-closure-fix-ekssib
thank you for your help. sorry for the response delay. i was sick last weeks.
Describe the bug ExpandAll does not work, no sub nodes are expanded CollapseAll collapse only one parent folder at a time
To Reproduce
Expected behavior all sub nodes should open, none of them are expanded using the controlledtreeenvironment. it works fine using uncontrolledtreeenvironment.
Screenshots
Desktop (please complete the following information):
Additional context react-complex-tree 2.1.1