From d56011b60f4ce35e0faa996c2cf643ec6b6504e3 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 11 Jan 2026 02:05:44 +0200 Subject: [PATCH] Skip redundant scroll adjustment --- public/script.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/script.js b/public/script.js index bbce39cac..d147f0d02 100644 --- a/public/script.js +++ b/public/script.js @@ -2136,11 +2136,12 @@ export function appendMediaToMessage(mes, messageElement, scrollBehavior = SCROL chatElement.scrollTop(scrollPosition); return; } - const newChatHeight = chatElement.prop('scrollHeight'); - const diff = newChatHeight - chatHeight; - if (Math.abs(diff) < 1) { + const newScrollPosition = chatElement.scrollTop(); + if (newScrollPosition > scrollPosition) { return; } + const newChatHeight = chatElement.prop('scrollHeight'); + const diff = newChatHeight - chatHeight; chatElement.scrollTop(scrollPosition + diff); };