-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
[Feature request] Disable / control unmounting of already mounted rows #298
Comments
This seems like a different kind of story than what Virtuoso is designed for, to be honest. Leaving the issue open for potential feedback, but my initial reaction is that I am unlikely to include such a mode. |
Fwiw, we were initially surprised that neither And that, in general, React itself seems to make this hard to implement (i.e. you'd need to trick the reconciler into keeping your DOM nodes around, probably by keeping them in the DOM but marked as Specifically the use case where we cared/wanted this caching for was:
So, this led to a weird type-ahead experience where it's very fast to filter down ( All of this said, I think now that we're on react-virtuoso, this is going to matter a lot less because we're never "rendering 100 rows" anyway, whether on the initial load or the un-filter-type-ahead case. So, dunno, it does seem intellectually fancy to cache these sort of "I just rendered that, and now have to do it again" DOM nodes, and IMO wouldn't hurt for |
This would help for lists that include images. Having the images re-fetched for users with caching disabled every time they scroll is a big hit to page size. |
In my case, this would help with a list of dynamically sized items that control their own state, which has an effect on the height of the item (collapsible menus inside of a row). Changing some state in 1 item will update the height of the list correctly, but as soon as you scroll down and the item unmounts, the height Virtuoso has in state is different from the actual height of the list, causing some weird jitters when scrolling back up. I've managed to partially solve this by saving the state of those dynamic components outside of the Virtuoso tree, and reusing it when rendering the components again, but it would be nice if there was a way to do this out of the box and not have to rerender the item at all. |
I don't see a way to do that without either "breaking" virtualization or doing some hacks around React DOM management. For future comers - having stateful items inside the virtualized list is not the way to go, as they get unmounted/remounted. Lifting state up the component tree is the solution for that. |
Hello, does anybody found the hack for unmounting? my render are very 'expensive' so I would like to avoid rendering them from teh beginning over and over again while user is scrolling |
Someone's made this feature request in bvaughn/react-window#234, I'd like to request it here as well.
The text was updated successfully, but these errors were encountered: