strat-gameplay-webapp/frontend-sba/composables
Cal Corum 751dcaf972 CLAUDE: Fix SSR/hydration issues in WebSocket composable
Refactored useWebSocket.ts to prevent SSR-related connection issues:

- Created ClientState interface to encapsulate all client-only state
- Added getClientState() function with lazy initialization on client only
- Added SSR guards (import.meta.client) to all connection functions
- Reset reactive state on client hydration to ensure clean slate
- Moved heartbeatInterval and stuckStateCheckInterval into ClientState
- Changed NodeJS.Timeout to ReturnType<typeof setTimeout/setInterval>
- Wrapped auth watcher in import.meta.client guard

Root cause: Module-level singleton state was being initialized during
SSR, then persisting in a potentially corrupted state during hydration.
This caused intermittent "Socket exists: no" issues where the browser
wouldn't even attempt WebSocket connections.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 15:29:24 -06:00
..
CLAUDE.md CLAUDE: Fix cookie security and SSR data fetching for iPad/Safari 2025-11-27 21:06:42 -06:00
useGameActions.ts CLAUDE: Add Undo Last Play feature for game rollback 2025-11-27 21:34:48 -06:00
useWebSocket.ts CLAUDE: Fix SSR/hydration issues in WebSocket composable 2025-11-29 15:29:24 -06:00