From 398bc96b1ad8e14fa6fdc3ff235e254d8ff8784a Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 24 Sep 2024 01:05:46 +0200 Subject: [PATCH] refac --- src/lib/components/chat/Messages.svelte | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index aa1cfb433..a8d0abf13 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -39,8 +39,15 @@ let messagesLoading = false; const loadMoreMessages = async () => { + // scroll slightly down to disable continuous loading + const element = document.getElementById('messages-container'); + element.scrollTop = element.scrollTop + 100; + messagesLoading = true; messagesCount += 20; + + await tick(); + messagesLoading = false; };