mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-12 09:01:18 +00:00
fix: keep the viewport in place when older messages load above it
This commit is contained in:
parent
31d08d592c
commit
9b170998d5
1 changed files with 5 additions and 4 deletions
|
|
@ -66,11 +66,8 @@
|
|||
});
|
||||
|
||||
const loadMoreMessages = async () => {
|
||||
// scroll slightly down to disable continuous loading
|
||||
const element = getMessagesContainer();
|
||||
if (element) {
|
||||
element.scrollTop = element.scrollTop + 100;
|
||||
}
|
||||
const previousScrollHeight = element?.scrollHeight ?? 0;
|
||||
|
||||
messagesLoading = true;
|
||||
messagesCount += 8;
|
||||
|
|
@ -79,6 +76,10 @@
|
|||
|
||||
await tick();
|
||||
|
||||
if (element) {
|
||||
element.scrollTop += element.scrollHeight - previousScrollHeight;
|
||||
}
|
||||
|
||||
messagesLoading = false;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue