From cf993b4ef066af335fcc6f9bff62eb0a9de6e313 Mon Sep 17 00:00:00 2001 From: Timo <6156589+Shik3i@users.noreply.github.com> Date: Mon, 18 May 2026 20:09:20 +0200 Subject: [PATCH] fix(background): reset reactive locks on execute force sync for instant play update --- extension/background.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/extension/background.js b/extension/background.js index acad1b8..40565a2 100644 --- a/extension/background.js +++ b/extension/background.js @@ -560,6 +560,18 @@ function handleServerEvent(event, data) { playbackState: 'playing' }); } + + // Reset reactive update locks for all peers so the next playing heartbeat is accepted immediately + if (currentRoom && Array.isArray(currentRoom.peers)) { + currentRoom.peers.forEach(peer => { + if (peer && typeof peer === 'object') { + peer.lastReactiveUpdate = 0; + } + }); + if (storageInitialized) chrome.storage.session.set({ currentRoom }); + chrome.runtime.sendMessage({ type: 'PEER_UPDATE', peers: currentRoom.peers }).catch(() => {}); + } + routeToContent(event, data); break; case EVENTS.EVENT_ACK: @@ -702,6 +714,18 @@ function executeForceSync() { forceSyncAcks: [], forceSyncDeadline: null }); + + // Reset reactive update locks for all peers so the next playing heartbeat is accepted immediately + if (currentRoom && Array.isArray(currentRoom.peers)) { + currentRoom.peers.forEach(peer => { + if (peer && typeof peer === 'object') { + peer.lastReactiveUpdate = 0; + } + }); + if (storageInitialized) chrome.storage.session.set({ currentRoom }); + chrome.runtime.sendMessage({ type: 'PEER_UPDATE', peers: currentRoom.peers }).catch(() => {}); + } + emit(EVENTS.FORCE_SYNC_EXECUTE, {}); routeToContent(EVENTS.FORCE_SYNC_EXECUTE, {}); addLog('Force Sync Executed', 'success');