fix(games): allow room creator to rejoin without error
Some checks failed
Deploy to Production / test (push) Failing after 34s

The room creator was added as a player during createRoom, but when
GameRoom mounted it sent JOIN_ROOM which failed with "Already in room",
leaving the UI stuck on the loading spinner. Now treats duplicate joins
as successful rejoins, which also fixes reconnection after page refresh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
syntaxbullet
2026-04-02 13:52:59 +02:00
parent b832723d6b
commit cac9fae142

View File

@@ -46,7 +46,7 @@ export class RoomManager {
const plugin = gameRegistry.get(room.gameSlug)!; const plugin = gameRegistry.get(room.gameSlug)!;
if (room.players.length >= plugin.maxPlayers) return { ok: false, error: "Room is full" }; if (room.players.length >= plugin.maxPlayers) return { ok: false, error: "Room is full" };
if (room.players.includes(playerId)) return { ok: false, error: "Already in room" }; if (room.players.includes(playerId)) return { ok: true, started: room.status === "playing" };
room.players.push(playerId); room.players.push(playerId);