Skip redundant scroll adjustment

This commit is contained in:
Cohee
2026-01-11 02:05:44 +02:00
parent ab164efea6
commit d56011b60f
+4 -3
View File
@@ -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);
};