From ea8965bc95379d005b4e2dc1b9ae3716dd24b065 Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Sun, 30 Nov 2025 15:04:37 -0600 Subject: [PATCH] fix(know-your-world): guard against undefined state during session init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add loading guard in GameComponent to prevent crash when state is undefined during session initialization. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/GameComponent.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/web/src/arcade-games/know-your-world/components/GameComponent.tsx b/apps/web/src/arcade-games/know-your-world/components/GameComponent.tsx index 8e3e24a6..b8df2369 100644 --- a/apps/web/src/arcade-games/know-your-world/components/GameComponent.tsx +++ b/apps/web/src/arcade-games/know-your-world/components/GameComponent.tsx @@ -27,6 +27,23 @@ export function GameComponent() { return () => window.removeEventListener(CROP_MODE_EVENT, handleCropModeChange) }, []) + // Guard against undefined state during session initialization + if (!state) { + return ( +
+ Loading... +
+ ) + } + // Determine current player for turn indicator (if turn-based mode) const currentPlayerId = state.gamePhase === 'playing' && state.gameMode === 'turn-based'