Fix client not receiving timerEnabled state from host

The client's gameConfig always used DEFAULT_GAME_CONFIG (timerEnabled: true),
so the GameScreen never showed the infinity symbol or End Question button.
Now the client syncs timerEnabled from QUESTION_START and WELCOME messages
into its local gameConfig state.
This commit is contained in:
Joey Yakimowich-Payne 2026-02-23 13:53:46 -07:00
commit b2f9f9a891
No known key found for this signature in database
GPG key ID: DDF6AF5B21B407D4

View file

@ -1507,6 +1507,9 @@ export const useGame = (defaultGameConfig?: GameConfig) => {
setGameState('LOBBY');
setHasAnswered(false);
}
if (payload.timerEnabled !== undefined) {
setGameConfig(prev => ({ ...prev, timerEnabled: payload.timerEnabled! }));
}
}
if (data.type === 'START_COUNTDOWN') {
@ -1546,6 +1549,9 @@ export const useGame = (defaultGameConfig?: GameConfig) => {
if (data.payload.timerEnabled !== false) {
timerRef.current = setInterval(() => setTimeLeft(prev => Math.max(0, prev - 100)), 100);
}
if (data.payload.timerEnabled !== undefined) {
setGameConfig(prev => ({ ...prev, timerEnabled: data.payload.timerEnabled! }));
}
}
if (data.type === 'RESULT') {