react-arborist
react-arborist copied to clipboard
Error with multiple trees
If you have 2 Tree components rendering at the same time a React Maximum update depth exceeded
error is thrown. The line below is causing the error.
useLayoutEffect(() => {
// @ts-ignore
dispatch(actions.setVisibleIds(api.visibleIds, api.idToIndex)); // <- causes the error.
}, [dispatch, api.visibleIds, api.idToIndex, props.root]);
Here is a codesandbox with a basic repro.
https://codesandbox.io/s/react-arborist-forked-xb7ezj
Thanks!
Oh, interesting. Thanks for repro. This will get looked into.
This is solved by https://github.com/brimdata/react-arborist/pull/49 as the tree nodes is now an array.
Great to hear that!