State reset after rounds
This commit is contained in:
parent
f9447b3deb
commit
09fb1e3938
@ -72,6 +72,9 @@ export const Game = () => {
|
|||||||
setRound(data.round);
|
setRound(data.round);
|
||||||
setPhase("composing");
|
setPhase("composing");
|
||||||
setTimeLeft(data.timeRemaining);
|
setTimeLeft(data.timeRemaining);
|
||||||
|
setSelectedSong(null);
|
||||||
|
setHasGuessed(false);
|
||||||
|
setGuessResult(null);
|
||||||
},
|
},
|
||||||
"guessing-phase-started": (data) => {
|
"guessing-phase-started": (data) => {
|
||||||
console.log("Guessing phase started:", data);
|
console.log("Guessing phase started:", data);
|
||||||
@ -229,6 +232,14 @@ export const Game = () => {
|
|||||||
}
|
}
|
||||||
}, [allSongs, songOptions]);
|
}, [allSongs, songOptions]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (phase === 'composing') {
|
||||||
|
setSelectedSong(null);
|
||||||
|
setHasGuessed(false);
|
||||||
|
setGuessResult(null);
|
||||||
|
}
|
||||||
|
}, [phase]);
|
||||||
|
|
||||||
const handleFrequencyChange = useCallback((newFrequency, isPlaying) => {
|
const handleFrequencyChange = useCallback((newFrequency, isPlaying) => {
|
||||||
setFrequency(newFrequency);
|
setFrequency(newFrequency);
|
||||||
setComposerIsPlaying(isPlaying);
|
setComposerIsPlaying(isPlaying);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user