theme_guess/frontend
Gabriel Franco 36b2725498 fix(frontend): share one ThemeGuessGame instance across solo/matchmaking/rooms
ThemeGuessGame's constructor permanently binds click/mousemove/document
listeners onto the single shared #code-canvas/#category-panel. Solo,
matchmaking, and private-room flows each independently constructed their
own instance, so using more than one mode in the same page load (e.g.
Solo then Find Match) left multiple instances double-bound to the same
DOM, corrupting whichever mode was used first.

Add game/sharedGame.ts: a single lazily-constructed instance, reused via
setTheme/setSnippet and now-mutable onCategoryAssigned across every
flow. main.ts, matchmakingFlow.ts, and privateRoomFlow.ts now call
getSharedGame() instead of `new ThemeGuessGame(...)`.

Verified via CDP DOMDebugger.getEventListeners against a live session:
exactly one click/mousemove listener on #code-canvas after playing a
Solo round followed by a real matched Matchmaking round in the same
page load (previously would have been two of each).
2026-09-10 14:31:59 -03:00
..
src fix(frontend): share one ThemeGuessGame instance across solo/matchmaking/rooms 2026-09-10 14:31:59 -03:00
.env.example feat(frontend): add WebSocket client service with identity and typed messages 2026-09-10 11:54:48 -03:00
index.html feat(frontend): add private room UI flow (create/join/repeat) 2026-09-10 14:07:20 -03:00
package-lock.json refactor(frontend): move to frontend/, port to Vite + TypeScript 2026-09-10 10:37:44 -03:00
package.json refactor(frontend): move to frontend/, port to Vite + TypeScript 2026-09-10 10:37:44 -03:00
tsconfig.json refactor(frontend): move to frontend/, port to Vite + TypeScript 2026-09-10 10:37:44 -03:00
vite.config.ts refactor(frontend): move to frontend/, port to Vite + TypeScript 2026-09-10 10:37:44 -03:00