Skip redundant scroll adjustment
This commit is contained in:
+4
-3
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user