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

ab164efea6b6f92ac8a7245da80a342e8f044747

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

Signed
1 files changed, +6 -1Ignore whitespace
public/script.js+6 -1
@@ -2138,6 +2138,9 @@ export function appendMediaToMessage(mes, messageElement, scrollBehavior = SCROL
21382138 }
21392139 const newChatHeight = chatElement.prop('scrollHeight');
21402140 const diff = newChatHeight - chatHeight;
2141+ if (Math.abs(diff) < 1) {
2142+ return;
2143+ }
21412144 chatElement.scrollTop(scrollPosition + diff);
21422145 };
21432146
@@ -10018,7 +10021,9 @@ export async function swipe(event, direction, { source, repeated, message = chat
1001810021 thisMesDiv.css('height', thisMesDivHeight);
1001910022 expandNewMessage(thisMesDiv);
1002010023
10021- appendMediaToMessage(chat[mesId], thisMesDiv);
10024+ if (run_generate) {
10025+ appendMediaToMessage(chat[mesId], thisMesDiv);
10026+ }
1002210027
1002310028 await eventSource.emit(event_types.MESSAGE_SWIPED, (mesId));
1002410029