From cac9fae14227d0192324e67771d51774143d1bef Mon Sep 17 00:00:00 2001 From: syntaxbullet Date: Thu, 2 Apr 2026 13:52:59 +0200 Subject: [PATCH] fix(games): allow room creator to rejoin without error 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) --- api/src/games/RoomManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/games/RoomManager.ts b/api/src/games/RoomManager.ts index 9d18884..5d66a0e 100644 --- a/api/src/games/RoomManager.ts +++ b/api/src/games/RoomManager.ts @@ -46,7 +46,7 @@ export class RoomManager { const plugin = gameRegistry.get(room.gameSlug)!; 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);