petyosi / react-virtuoso

The most powerful virtual list component for React
https://virtuoso.dev
MIT License
5.13k stars 299 forks source link

[BUG] Not unloading no longer visible items #1058

Closed danielmag closed 5 months ago

danielmag commented 5 months ago

Describe the bug I am trying to migrate from react-virtualized to react-virtuoso and so far found almost everything super straightforward and was actually able to delete a bunch of code that is not longer needed with your library 🎉

One thing that seems to be working differently is that rangeChanged does not seem to trigger when previous elements are no longer visible when scrolling down, only when new ones need to be rendered. In virtualized I used onRowsRendered for this purpose and it triggered whenever previous elements where no longer visible, removing them from the DOM. Is there any way to have a similar behaviour with virtuoso? I am particularly interested in knowing reliably with is the first visible element on the list.

This especially apparent with variable sized elements (see screenshots below)

Screenshots

Screenshot 2024-04-02 at 16 04 45 Screenshot 2024-04-02 at 16 05 42
petyosi commented 5 months ago

This has been discussed previously - search the issues. I think the github issue thread is also mentioned in the docs.

danielmag commented 5 months ago

Thanks for the fast response! I could not find any similar issue though, only this one but it is not relevant since I am not using overscan

danielmag commented 4 months ago

@petyosi could you point me to the issue where this has been already discussed? After a further search I could not find it. Thank you!