Keep the presence client id across a reload
A reload drew this tab's own previous self as a colleague for ~40 s: the server held the old client id until its TTL and the new page had a fresh newClientId(). The id now lives in sessionStorage, one key per deck (fixtures/client-id.mjs), so a reload reuses it. A duplicated tab copies sessionStorage, so each tab claims its id on a BroadcastChannel; a live tab holding it answers and the newcomer switches to a fresh one (presence.setClientId beats with it at once). No leave-on-pagehide: the server has no leave route, and with a stable id a reload no longer needs one. Node: client-id.test.mjs. Browser: TestBrowserReloadIsNotSomebodyElse.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 files changed,
+265
−20
fixtures/client-id.mjs+62 −0fixtures/client-id.test.mjs+107 −0fixtures/editor-entry.js+20 −1fixtures/presence.mjs+14 −4internal/slides/static/{editor.ea69e9f399e840e0.js => editor.94492ae03aa185ba.js}+15 −15internal/slidestest/browser_editor_presence_test.go+47 −0
fixtures/client-id.mjsLoading diff…
fixtures/client-id.test.mjsLoading diff…
fixtures/editor-entry.jsLoading diff…
fixtures/presence.mjsLoading diff…
internal/slides/static/{editor.ea69e9f399e840e0.js => editor.94492ae03aa185ba.js}Loading diff…
internal/slidestest/browser_editor_presence_test.goLoading diff…