fix(know-your-world): guard against undefined state during session init
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 <noreply@anthropic.com>
This commit is contained in:
parent
60cf98e77a
commit
ea8965bc95
|
|
@ -27,6 +27,23 @@ export function GameComponent() {
|
|||
return () => window.removeEventListener(CROP_MODE_EVENT, handleCropModeChange)
|
||||
}, [])
|
||||
|
||||
// Guard against undefined state during session initialization
|
||||
if (!state) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
height: '100vh',
|
||||
color: '#888',
|
||||
}}
|
||||
>
|
||||
Loading...
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Determine current player for turn indicator (if turn-based mode)
|
||||
const currentPlayerId =
|
||||
state.gamePhase === 'playing' && state.gameMode === 'turn-based'
|
||||
|
|
|
|||
Loading…
Reference in New Issue