Closed lithdew closed 1 year ago
I'm a confused. Your issue says initialItemIndex
(there's no such property), but your sandbox uses initialItemCount
. If you mean to use initialItemCount then what you're doing is rendering all items in the initial render (this stops endReached from being called), only to have them removed by the virtualization logic. What are you trying to do here?
Apologies, I meant initialItemCount
(will rename title).
My intent was to have an infinite-scrolling list where initialItemCount
rows are server-side rendered, and further rows may be loaded when the end is reached (the same behavior as specifying initialItemCount
with data
, but specifying totalCount
instead of data
).
This was an attempt in circumventing this issue to do with the infinite list re-rendering/blinking on mount despite the list being initially server-side rendered in NextJS: https://github.com/petyosi/react-virtuoso/issues/763 (contrary to the issue, the blinking on mount does appear to happen on NextJS. Happy to provide a reproduction w/ NextJS).
I see. You can use count - 1
as the initialItemCount, this should enable endReached. I am aware of #763 being applicable to next too - that's why the issue is still open.
To be honest, what you're doing seems more like an endless scroll that does not really need virtualization. Virtuoso can still be used in that scenario, but obviously, this is not what it's meant for.
@lithdew FYI, #763 has been closed, give it a try.
@lithdew FYI, #763 has been closed, give it a try.
Seem to still hit the same issue of endReached not being called. Tried set initialItemCount to be the same as totalCount, and also tried alternatively set data instead of totalCount.
Sorry for the confusion. endReached will not be called when initialItemCount
equals the totalCount - fixing that would be a breaking change in the behavior.
The fix I've mentioned is related to the flickering in #763.
Describe the bug endReached is not called when initialItemCount and totalCount are specified.
Reproduction https://codesandbox.io/s/boring-sara-rf9jry?file=/App.js
To Reproduce Steps to reproduce the behavior:
Expected behavior Expect 'END REACHED' to be logged to console, but nothing was logged.
Desktop (please complete the following information):