Fix: don't call append media twice on swipe (#4991)

ab164efea6b6f92ac8a7245da80a342e8f044747

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

Signed
1 files changed, +5 -0Showing whitespace changes
public/script.js+5 -0
@@ -2138,6 +2138,9 @@ export function appendMediaToMessage(mes, messageElement, scrollBehavior = SCROL
2138 }2138 }
2139 const newChatHeight = chatElement.prop('scrollHeight');2139 const newChatHeight = chatElement.prop('scrollHeight');
2140 const diff = newChatHeight - chatHeight;2140 const diff = newChatHeight - chatHeight;
2141 if (Math.abs(diff) < 1) {
2142 return;
2143 }
2141 chatElement.scrollTop(scrollPosition + diff);2144 chatElement.scrollTop(scrollPosition + diff);
2142 };2145 };
21432146
@@ -10018,7 +10021,9 @@ export async function swipe(event, direction, { source, repeated, message = chat
10018 thisMesDiv.css('height', thisMesDivHeight);10021 thisMesDiv.css('height', thisMesDivHeight);
10019 expandNewMessage(thisMesDiv);10022 expandNewMessage(thisMesDiv);
1002010023
10024 if (run_generate) {
10021 appendMediaToMessage(chat[mesId], thisMesDiv);10025 appendMediaToMessage(chat[mesId], thisMesDiv);
10026 }
1002210027
10023 await eventSource.emit(event_types.MESSAGE_SWIPED, (mesId));10028 await eventSource.emit(event_types.MESSAGE_SWIPED, (mesId));
1002410029