From 6c9354968513561aa24bf7823a6f1497f391a1f2 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Wed, 3 Jun 2026 14:43:50 -0400 Subject: [PATCH] zebra-spaces: preserve mute state across explicit leave/rejoin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Was: leave button cleared MUTE_STATE_KEY, so a rejoin via bless-reclaim came back unmuted regardless of prior choice. Fox: 'when I leave and rejoin the mic state is unmuted.' Now: keep MUTE_STATE_KEY in sessionStorage on leave (same tab, same identity → same preference). Next promotion or bless-reclaim restores via applyMuteState, matching the hard-refresh path's behavior. The local in-page `muted` variable still syncs to whatever's in storage so the dormant-tab state is consistent. --- web/zebra-spaces.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web/zebra-spaces.html b/web/zebra-spaces.html index 62db2e4..3ccdc65 100644 --- a/web/zebra-spaces.html +++ b/web/zebra-spaces.html @@ -4106,8 +4106,13 @@ $('btn-leave').addEventListener('click', async () => { $('btn-enter').disabled = false; $('btn-leave').disabled = true; $('btn-mute').disabled = true; - $('btn-mute').textContent = 'mute'; $('btn-mute').className=''; muted = false; - try { sessionStorage.removeItem(MUTE_STATE_KEY); } catch(_){} + $('btn-mute').textContent = 'mute'; $('btn-mute').className=''; + /* Preserve the user's last mute choice across leave+rejoin — + * fox: 'when I leave and rejoin the mic state is unmuted'. Don't + * touch MUTE_STATE_KEY here; the next promotion / bless-reclaim + * reads it back via applyMuteState. The local `muted` variable + * still resets so the in-page UI is clean while disconnected. */ + muted = (function(){ try { return sessionStorage.getItem(MUTE_STATE_KEY) === '1'; } catch(_){ return false; } })(); logLine('', 'left the space'); }); @@ -4117,8 +4122,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');