petyosi / react-virtuoso

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

[BUG] VirtuosoGrid - endReached doesn't call if data set is less then the container #1087

Open dinataranis opened 3 months ago

dinataranis commented 3 months ago

Describe the bug I am using VirtuosoGrid component with endReached method and if an initial data set is less then the container the endReached is not fired (if I switch to Virtuoso component endReached is fired) I have checked the similar issues: https://github.com/petyosi/react-virtuoso/issues/919 https://github.com/petyosi/react-virtuoso/issues/924 and as I see VirtuosoGrid and Virtuoso components behave differently towards endReached method if the initial data set is less then the container

Reproduction Virtuoso with endReached works as expected VirtuosoGrid with endReached the initial fire doesn't work

Expected behavior I expect both Virtuoso and VirtuosoGrid to work the same way and to fire the initial endReached if the data set is less then the container (at least one time)

erdemdev commented 2 months ago

I ran into this issue too. I'm glad I checked the issues section; otherwise, I would still be struggling with it. For now, I worked around it using the Intersection Observer API.

stuartambient commented 2 days ago

i found that endReached doesn't trigger at all even if data is more than container. There is nothing in the docs that confirms endReached is part of VirtuosoGrid.