Fix: don't call append media twice on swipe (#4991)
Signed| @@ -2138,6 +2138,9 @@ export function appendMediaToMessage(mes, messageElement, scrollBehavior = SCROL | ||
| 2138 | 2138 | } |
| 2139 | 2139 | const newChatHeight = chatElement.prop('scrollHeight'); |
| 2140 | 2140 | const diff = newChatHeight - chatHeight; |
| 2141 | + if (Math.abs(diff) < 1) { | |
| 2142 | + return; | |
| 2143 | + } | |
| 2141 | 2144 | chatElement.scrollTop(scrollPosition + diff); |
| 2142 | 2145 | }; |
| 2143 | 2146 | |
| @@ -10018,7 +10021,9 @@ export async function swipe(event, direction, { source, repeated, message = chat | ||
| 10018 | 10021 | thisMesDiv.css('height', thisMesDivHeight); |
| 10019 | 10022 | expandNewMessage(thisMesDiv); |
| 10020 | 10023 | |
| 10024 | + if (run_generate) { | |
| 10021 | 10025 | appendMediaToMessage(chat[mesId], thisMesDiv); |
| 10026 | + } | |
| 10022 | 10027 | |
| 10023 | 10028 | await eventSource.emit(event_types.MESSAGE_SWIPED, (mesId)); |
| 10024 | 10029 | |