Bug while expanding nodes with more than 32766 children - v3
See original GitHub issueFrist of all, thanks for the amazing work put into the lib. It’s very awesome.
Conditions for reproducing:
- You need to have a node (lets call A) with 32767 children or more (do not know if they need to be direct children, I think not)
- And you need to have one of more nodes after node A.
- All my testing was done in latest chrome, using windows 10 and MacOs
I prepared a reproduction of the bug here: https://github.com/sirgallifrey/react-vtree/tree/openning-lots-of-nodes
How to reproduce:
- Checkout my fork on the branch called:
openning-lots-of-nodes
- run storybook:dev script
- Go to story called
Big List Issue
- Scroll all the way to the bottom and observe that everything renders properly so far.
- Scroll back up and collapse the node called
Root.2
- Observe that everything still works as expected.
- Expand the node called
Root.2
and scroll all the way to the bottom - Observe that some nodes appear missing, some may be duplicated.
- From now on, collapsing and expanding
Root.2
will not fix the issue. - Collapsing and then expanding the node
Root
will fix the issue end render everything properly, but issue can comeback by expandingRoot.2
There is one extra glitch that I’m seeing in this reproduction that I didn’t saw when I first used the lib: If you keep collapsing and expanding Root.2
you will end up with a ghost floating element that will not go away even by collapsing and expanding the parent. But the following workaround prevents that
Workaround:
Since opening the root node fixes the issue, it is possible to use recomputeTree
instead of setOpen
and always open the root node with every instruction, an example of the workaround can be found on my fork, in the story named: Big List Issue workaround
I didn’t had time yet to try find the bug on the code, but since the issue happens at such specific number of itens it’s probably happening inside the updateExistingTree
https://github.com/Lodin/react-vtree/blob/master/src/Tree.tsx#L402
Pictures / videos:
https://user-images.githubusercontent.com/2331645/106302660-881ac800-6259-11eb-8e29-8965973707e7.mov
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (12 by maintainers)
Hey, @sirgallifrey. I think I fixed the bug: there was a miscalculation in the array length. Could you please check if the
fix/max-args-bug
branch works for you?Hello @Lodin I merged the new changes on my reproduction branch and the issue is still reproducible https://github.com/sirgallifrey/react-vtree/tree/openning-lots-of-nodes
I’ll give a shot at trying to fix it