Skip to content

Fix stale-cache asset loading; add broker connection watchdog#3

Merged
oofnish merged 2 commits into
mainfrom
claude/fix-asset-cache-busting
Jun 1, 2026
Merged

Fix stale-cache asset loading; add broker connection watchdog#3
oofnish merged 2 commits into
mainfrom
claude/fix-asset-cache-busting

Conversation

@oofnish
Copy link
Copy Markdown
Owner

@oofnish oofnish commented Jun 1, 2026

The bug

After #2 merged, creating a connection showed a permanent instead of a word code, and the "Copy code" button did nothing — with no console errors.

Root cause: a stale browser cache. The browser loaded the new index.html (easy mode) but kept running a cached app.js from #1 (manual-only). That old script set the status to "Generating invite…" / "Waiting for reply code", never touched #my-code (so it stayed at the static ), and had no handler for the new Copy button — and ran without errors because it only knew about the old elements. The deployed app.js was correct all along.

The fix

  • Cache-bust asset references with ?v= query strings (style.css?v=3, app.js?v=3, vendor/peerjs.min.js?v=1.5.4). When the HTML updates, the new URLs force a fresh fetch of the scripts, so a browser can't pair fresh HTML with a stale script again. (Bump the number on future asset changes — noted in an HTML comment.)
  • Broker watchdog: a 15s timer on the signaling connection. If the broker never confirms registration, the UI shows "Could not reach the signaling broker… use the manual code" instead of hanging on . Cleared on connect, on error, and on cancel/disconnect.

Note for existing users

Anyone who already loaded the old version may need one hard refresh (Cmd/Ctrl+Shift+R) to pick up the versioned URLs; after that, cache-busting handles future updates automatically.

https://claude.ai/code/session_01BkoDW5wUsLsAtTse9djhki


Generated by Claude Code

claude added 2 commits June 1, 2026 17:37
Versions the style.css/app.js/peerjs script references with ?v= query
strings so a browser can't run a cached old script against fresh HTML
(which made the easy-mode code show a permanent '…' and a dead Copy
button). Also adds a 15s watchdog on the signaling broker so a genuine
stall shows an error and points to manual mode instead of hanging.
PeerJS 1.5 registers serializers raw/json/binary/binary-utf8 but no
'none' (it exists only as an enum value), so peer.connect with
serialization:'none' threw 'this._serializers[t.serialization] is not a
constructor'. 'raw' passes strings and binary through untouched, matching
our own chunking and the string-vs-ArrayBuffer handling in onMessage.
@oofnish oofnish temporarily deployed to github-pages June 1, 2026 17:45 — with GitHub Pages Inactive
@oofnish oofnish merged commit aff4154 into main Jun 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants