Skip redundant scroll adjustment

d56011b60f4ce35e0faa996c2cf643ec6b6504e3

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -3Showing whitespace changes
public/script.js+4 -3
@@ -2136,11 +2136,12 @@ export function appendMediaToMessage(mes, messageElement, scrollBehavior = SCROL
21362136 chatElement.scrollTop(scrollPosition);
21372137 return;
21382138 }
21392139 const newChatHeightnewScrollPosition = chatElement.propscrollTop('scrollHeight');
2140- const diff = newChatHeight - chatHeight;
2140+ if (newScrollPosition > scrollPosition) {
2141- if (Math.abs(diff) < 1) {
21422141 return;
21432142 }
2143+ const newChatHeight = chatElement.prop('scrollHeight');
2144+ const diff = newChatHeight - chatHeight;
21442145 chatElement.scrollTop(scrollPosition + diff);
21452146 };
21462147