fix(ui): move buffer clear from call-end to call-start
Some checks failed
Mirror to GitHub / mirror (push) Failing after 25s
Build Release Binaries / build-amd64 (push) Failing after 3m42s

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) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-04-14 15:17:16 +04:00
parent db5751985e
commit 16dcc75514

View File

@@ -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();