diff --git a/conversations.php b/conversations.php index 8836a03..a0402ef 100644 --- a/conversations.php +++ b/conversations.php @@ -1948,6 +1948,20 @@ if (nearBottomNow && !this._userScrolling) this.scrollToBottom(); } + // If we received any delta messages, perform an immediate full fetch to sync any server-side batching + if (messages.length > 0) { + if (!this._fullLoadInProgress) { + try { + if (console && console.debug) console.debug('pollNewMessages: delta returned, triggering immediate full reload'); + await this.loadMessages(this.currentUserId, true, nearBottomNow && !this._userScrolling); + } catch (e) { + console.warn('Immediate full reload after delta failed', e); + } + } else { + if (console && console.debug) console.debug('Immediate full reload skipped because another full load is in progress'); + } + } + // update latest timestamp from the last message try { const last = messages[messages.length - 1];