petyosi / react-virtuoso

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

[BUG] atBottomStateChange fires multiple times on mount. #497

Closed JavierM42 closed 2 years ago

JavierM42 commented 2 years ago

Describe the bug The atBottomStateChange callback fires at least twice when the Virtuoso component mounts.

Reproduction https://stackblitz.com/edit/react-opcwka?file=src/App.js

To Reproduce Check the console and see the three logs on every reload: false, then true, then false again.

If you set initialTopMostItemIndex=999999, atBottomStateChange will fire a fourth time with value true.

If there are not enough elements to introduce a scrollbar, it will fire only two times (first false, then true).

Expected behavior atBottomStateChange only fires once on mount, with the correct value.

Screenshots

Screen Shot 2021-11-12 at 11 32 36

Desktop (please complete the following information):

petyosi commented 2 years ago

That would be an improvement indeed, but I am not sure when I can get to it. In the mean time, debouncing it should work as a workaround.

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 2.8.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: