Preseving item state after scrolling away
See original GitHub issueHi 😃
Just wanted to say thank you for the most simple virtualization library I’ve ever seen. I’ve been through react-virtualized and react-window, and this one is just heaven.
I do have one question though: When I expand one of my list items, It won’t be expanded the next time it will be mounted. In other words - it seems like I lose the component’s state when it’s out of view.
Here’s an example:

As you can see, the default state is collapsed. I expand one of the items, scroll down, and scroll back up to make it inside the view again, and it’s collapsed again. You can see the scrollbar jumping a few pixels when the list item gets remounted with a wrong height (collapsed instead of expanded, but the virtual list remembers the last height).
I couldn’t find anything related to this on docs.
How can this be solved? I imagine some kind of memoization, but I couldn’t make it work.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (1 by maintainers)

Top Related StackOverflow Question
Here’s a basic sandbox complete with a basic redux set up. If you’re not familiar with using redux, this might appear a bit confusing and I recommend a good tutorial - perhaps even a tutorial series. I’ve tried to add plenty of comments where I think they’re needed for clarification.
@itayganor Can I see the code for this expandable list you made?