startReached only ever gets called once? #1177
-
Hey there. Having an issue with reversed infinite scroll in a chat app. Basically I'm using the startReached prop in reversed mode, and it only triggers once when scrolling to the top. After loading the first batch of messages, it never triggers again no matter how much I scroll up, I have literally restart the app to get it to trigger again. Steps to reproduce:
Expected behavior: startReached should trigger every time we scroll to the top and there are more messages to load. Similar to how endReached works. Replacing startReached with endReached in my application's code, it works exactly how I need it to, the only issue is I need it to trigger at the top of the scroll container and not the bottom. Actual behavior: startReached only triggers once, then never again. Any ideas what I might be doing wrong here? Let me know if you need any additional info! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
@JamesReich I highly recommend the message list component for chat interfaces. Its API is much more robust for this use case https://virtuoso.dev/virtuoso-message-list/tutorial/loading-older-messages/. |
Beta Was this translation helpful? Give feedback.
-
So probably not ideal but we went ahead and solved this by literally inverting our chat window and its children. Then endReached, which is working exactly how we need, is now the "top" of the window. Resulting in a proper reverse infinite scroll. This will work for our use case, your mileage may vary. |
Beta Was this translation helpful? Give feedback.
-
"react-virtuoso": "^4.12.3"
|
Beta Was this translation helpful? Give feedback.
So probably not ideal but we went ahead and solved this by literally inverting our chat window and its children. Then endReached, which is working exactly how we need, is now the "top" of the window. Resulting in a proper reverse infinite scroll. This will work for our use case, your mileage may vary.