State reset after rounds

This commit is contained in:
Mathias Wagner 2025-03-01 17:39:25 +01:00
parent f9447b3deb
commit 09fb1e3938

View File

@ -72,6 +72,9 @@ export const Game = () => {
setRound(data.round);
setPhase("composing");
setTimeLeft(data.timeRemaining);
setSelectedSong(null);
setHasGuessed(false);
setGuessResult(null);
},
"guessing-phase-started": (data) => {
console.log("Guessing phase started:", data);
@ -229,6 +232,14 @@ export const Game = () => {
}
}, [allSongs, songOptions]);
useEffect(() => {
if (phase === 'composing') {
setSelectedSong(null);
setHasGuessed(false);
setGuessResult(null);
}
}, [phase]);
const handleFrequencyChange = useCallback((newFrequency, isPlaying) => {
setFrequency(newFrequency);
setComposerIsPlaying(isPlaying);