21 lines
1.0 KiB
Markdown
21 lines
1.0 KiB
Markdown
|
|
# 2024-12-18 16:45:00 - Implement Game Persistence on Reload
|
|
|
|
## Description
|
|
Updated `LobbyManager.tsx` to ensure that when a user reloads the page and automatically rejoins a room, the active game state (`initialGameState`) is correctly retrieved from the server and passed to the game view components.
|
|
|
|
## Key Changes
|
|
- **Component**: `LobbyManager.tsx`
|
|
- **Functionality**:
|
|
- Added `initialGameState` state.
|
|
- Updated `join_room` and `rejoin_room` response handling to capture `gameState` if present.
|
|
- Passed `initialGameState` to the `GameRoom` component.
|
|
|
|
## Impact
|
|
- **User Experience**: If a user is in the middle of a game (battlefield phase) and refreshes the browser, they will now immediately see the battlefield state instead of a loading or broken screen, ensuring continuity.
|
|
- **Data Flow**: `GameRoom` uses this prop to initialize its local `gameState` before the first socket update event arrives.
|
|
|
|
## Status
|
|
- [x] Implementation logic complete.
|
|
- [ ] User testing required (refresh page during active game).
|