From f12bb0a5329eacc74674575eaaa04fbec250f78a Mon Sep 17 00:00:00 2001 From: Timo <6156589+Shik3i@users.noreply.github.com> Date: Mon, 15 Jun 2026 14:22:17 +0200 Subject: [PATCH] fix(extension): reset reconnectAttempts on leave to prevent stale reconnecting status After LEAVE_ROOM or idle-leave, reconnectAttempts was not reset. GET_STATUS would return 'reconnecting' instead of 'disconnected', showing wrong status in popup and leaving Retry button visible. --- extension/background.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extension/background.js b/extension/background.js index 7ca9ff9..19ea3dc 100644 --- a/extension/background.js +++ b/extension/background.js @@ -406,6 +406,9 @@ function clearTargetTabForIdle() { async function leaveRoomAfterIdleGrace(reason) { if (!currentRoom) return; connectIntent = false; + reconnectFailed = false; + reconnectAttempts = 0; + chrome.storage.session.set({ reconnectFailed: false, reconnectAttempts: 0, reconnectStartTime: null }); emit(EVENTS.LEAVE_ROOM, { peerId }); forceDisconnect(); currentRoom = null; @@ -1500,6 +1503,9 @@ async function handleAsyncMessage(message, sender, sendResponse) { }); } else if (message.type === 'LEAVE_ROOM') { connectIntent = false; + reconnectFailed = false; + reconnectAttempts = 0; + chrome.storage.session.set({ reconnectFailed: false, reconnectAttempts: 0, reconnectStartTime: null }); resetAudioProcessingInTab(currentTabId); emit(EVENTS.LEAVE_ROOM, { peerId }); currentRoom = null;