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 | 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 | }; |
| 2143 | 2146 | ||
| @@ -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); |
| 10020 | 10023 | ||
| 10021 | appendMediaToMessage(chat[mesId], thisMesDiv); | 10024 | if (run_generate) { |
| 10025 | appendMediaToMessage(chat[mesId], thisMesDiv); | ||
| 10026 | } | ||
| 10022 | 10027 | ||
| 10023 | await eventSource.emit(event_types.MESSAGE_SWIPED, (mesId)); | 10028 | await eventSource.emit(event_types.MESSAGE_SWIPED, (mesId)); |
| 10024 | 10029 | ||