diff --git a/conversations.php b/conversations.php index d111470..59ac3fb 100644 --- a/conversations.php +++ b/conversations.php @@ -3678,7 +3678,25 @@ el.style.borderRadius = '20px'; el.style.boxShadow = '0 6px 18px rgba(2,6,23,0.12)'; el.style.cursor = 'pointer'; - el.onclick = () => this.applyStagedMessages(); + el.onclick = async () => { + try { + // Hide indicator immediately and suspend auto-refresh to avoid races + this.hideNewMessagesIndicator(); + this._suspendAutoRefresh = true; + if (this.currentUserId) { + // Trigger a full load and follow to bottom + await this.loadMessages(this.currentUserId, true, true); + } + // Clear staged messages since full load will include them + this._stagedMessages = []; + if (this._stagedMessageIds) this._stagedMessageIds.clear(); + this._stagedCount = 0; + } catch (e) { + console.warn('Indicator click failed to load full conversation', e); + } finally { + try { this._suspendAutoRefresh = false; } catch(e) {} + } + }; // subtle fade-in el.style.opacity = '0'; el.style.transition = 'opacity 220ms ease, transform 220ms ease';