Skip to content
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

Node row re-renders when <Tree/> data prop changes #293

Open
abrman opened this issue Jan 23, 2025 · 0 comments
Open

Node row re-renders when <Tree/> data prop changes #293

abrman opened this issue Jan 23, 2025 · 0 comments

Comments

@abrman
Copy link

abrman commented Jan 23, 2025

The entire list is virtualized so I wouldn't really mind re-renders, however I'm using react-arborist for a directory data tree-view with drag and drop upload. During upload, I have a spinner that shows up next to the item signifying it's uploading state, however with progress updates (percentage uploaded) being part of the node data, the Row kept re-rendering and the spinner was stuttering. (Simple tailwind animate-spin)

I commented out line 29 of row-container.tsx

// useDataUpdates(); // Re-render when tree props or visability changes

this seems to have done the trick, but I'm not sure if I should expect any issues I might run into by removing it.
What was the idea between adding this? Visibility updates?

Thanks for sharing this component with the open source community! 👍

Edit: Clearly not the solution :( only some updates get propagated down now.

Edit2: Following the advice from react-window discussions I ralized my renderRow prop was being passed as an anonymous function, and thus re-rendered every time. Should be solved now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant