tree icon indicating copy to clipboard operation
tree copied to clipboard

Virtualisation is not working on initial render when defaultExpandedKeys is set.

Open s-yadav opened this issue 3 years ago • 0 comments

When defaultExpandedKeys prop is provided the virtualisation breaks. On debugging looks like the issue is originated from this line.

https://github.com/react-component/tree/blob/master/src/NodeList.tsx#L201

Where we are checking if expanded keys are changed, and if the changed keys length is only one. In all other cases it will not apply the virtualisation logic. I am assuming same thing will happen if expandedKeys prop is provided.

That logic breaks on initial render, as the prevExpandedKeys and expandedKeys will be same. Also, may fail when two items are expanded at once (programatically).

Can dive more into it, and raise a PR, before that wanted to get more context on the logic behind it.

s-yadav avatar Nov 30 '21 13:11 s-yadav