houserules/packages/chess/src/app
Joey Yakimowich-Payne a7ec140cef
fix(chess): use ref-based guard for shared-link auto-join to prevent StrictMode double-join
React 18 StrictMode runs effects twice on mount in dev. The previous
state-based guard (joining) couldn't prevent the second invocation
from firing room.join because both passes see the deferred state
as null. The server accepts the first join as black, rejects the
second with ROOM_FULL, and the user sees an incorrect error toast.

Switching to useRef gives synchronous visibility — the second pass
sees joinedCodeRef.current already set and bails. Ref is reset on
.catch so a legitimate retry from the lobby isn't permanently
blocked.
2026-04-18 16:26:35 -06:00
..
App.tsx fix(chess): use ref-based guard for shared-link auto-join to prevent StrictMode double-join 2026-04-18 16:26:35 -06:00
index.css feat(chess): scaffold Vite + React app (P3.9) 2026-04-16 15:54:32 -06:00
main.tsx feat(chess): scaffold Vite + React app (P3.9) 2026-04-16 15:54:32 -06:00