-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refresh tree after adding element #611
Comments
Did Anyone find solution? |
The state might be getting mutated which prevents rerender. If the state is not mutated than React will handle the rerender. |
does anyone has a solution on this?? |
I found the solution by inserting spread. For example, code before was: const addCategory = async (node, lowerSiblingCounts) => { const route = lowerSiblingCounts.slice(0, lowerSiblingCounts.length - 1); const result = await updatingTree(node, treeData, route, 0); setTreeData(result); }; And now it's: |
Maybe this can help you |
setTreeData([...result]) did the trick for me. Spent too much time trying to figure out the issue so thank you very much nestorovicevo! |
Hi, I used
<SortableTree treeData={treeData} ... >
and I have situations when treeData is changed after adding new elements in tree
state with treeData is changed but SortableTree is not updated, I can see new elements only after any actions with SortableTree like dragging.
Is there way to refresh SortableTree after some actions not in SortableTree?
The text was updated successfully, but these errors were encountered: