making showMoreMessages async to await event emission

This commit is contained in:
qvink
2025-01-22 08:36:47 -07:00
parent 1641b1f91f
commit f1923c5364
3 changed files with 7 additions and 7 deletions

View File

@ -1830,7 +1830,7 @@ export async function replaceCurrentChat() {
}
}
export function showMoreMessages(messagesToLoad = null) {
export async function showMoreMessages(messagesToLoad = null) {
const firstDisplayedMesId = $('#chat').children('.mes').first().attr('mesid');
let messageId = Number(firstDisplayedMesId);
let count = messagesToLoad || power_user.chat_truncation || Number.MAX_SAFE_INTEGER;
@ -1861,7 +1861,7 @@ export function showMoreMessages(messagesToLoad = null) {
$('#chat').scrollTop(newHeight - prevHeight);
}
eventSource.emit(event_types.MORE_MESSAGES_LOADED)
await eventSource.emit(event_types.MORE_MESSAGES_LOADED)
}
export async function printMessages() {
@ -11468,8 +11468,8 @@ jQuery(async function () {
$('#avatar-and-name-block').slideToggle();
});
$(document).on('mouseup touchend', '#show_more_messages', () => {
showMoreMessages();
$(document).on('mouseup touchend', '#show_more_messages', async function () {
await showMoreMessages();
});
$(document).on('click', '.open_characters_library', async function () {