feat: implement infinite scroll for message history in chat view
Add scroll event listener to messages container that triggers loading of older messages when user scrolls to top. Fix indentation of isLoadingExtra flag to execute after all messages are inserted, ensuring correct state management during pagination.
This commit is contained in:
@@ -89,7 +89,8 @@
|
||||
const messages = await app.rpc.getMessages(channelUid, 1, offsetMessage.dataset.created_at);
|
||||
messages.forEach((message) => {
|
||||
firstMessage.insertAdjacentHTML("beforebegin", message.html);
|
||||
isLoadingExtra = false;
|
||||
})
|
||||
isLoadingExtra = false;
|
||||
}
|
||||
messagesContainer.addEventListener("scroll",()=>{
|
||||
loadExtra()
|
||||
|
||||
Reference in New Issue
Block a user