From 16dcc75514a40eb31e594959917f63bc48798fe3 Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Tue, 14 Apr 2026 15:17:16 +0400 Subject: [PATCH] fix(ui): move buffer clear from call-end to call-start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clearing callDebugBuffer in showConnectScreen() wiped all debug events the moment a call ended, so the user saw empty logs. Moved the clear to showCallScreen() instead — the buffer is reset at the START of a new call, not the end. This way: - After hanging up, all events from the call are still visible - Starting a new call clears stale data from the previous one - The reverse().find() for P2P badge still gets fresh data Co-Authored-By: Claude Opus 4.6 (1M context) --- desktop/src/main.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/desktop/src/main.ts b/desktop/src/main.ts index 87e7901..00f4acc 100644 --- a/desktop/src/main.ts +++ b/desktop/src/main.ts @@ -852,6 +852,12 @@ function showCallScreen() { connectScreen.classList.add("hidden"); callScreen.classList.remove("hidden"); + // Clear stale call-debug events from previous call so the P2P + // badge doesn't pick up old path_negotiated data. Cleared here + // (start of new call) rather than showConnectScreen (end of call) + // so the user can still read logs after hanging up. + callDebugBuffer.length = 0; + // Direct call → phone-style layout; room call → group layout. if (directCallPeer) { const fp = directCallPeer.fingerprint || ""; @@ -886,9 +892,6 @@ function showConnectScreen() { connectBtn.textContent = "Connect"; levelBar.style.width = "0%"; directCallPeer = null; - // Clear stale call-debug events so the next call's P2P indicator - // doesn't pick up a path_negotiated from a previous call. - callDebugBuffer.length = 0; // Clear the media-degraded banner if present const banner = document.getElementById("media-degraded-banner"); if (banner) banner.remove();