diff --git a/components/Game.tsx b/components/Game.tsx index ad2650b..b52faf5 100644 --- a/components/Game.tsx +++ b/components/Game.tsx @@ -171,8 +171,25 @@ export default function Game({ dailyPuzzle, genre = null, isSpecial = false, max // Use gameState directly for isSolved/isFailed to ensure consistency when returning to completed puzzles // Always use gameState values directly - they are the source of truth // This ensures that when returning to a completed puzzle, the result is shown immediately - const isSolved = Boolean(gameState.isSolved); - const isFailed = Boolean(gameState.isFailed); + // IMPORTANT: Check gameState.isSolved/isFailed directly, not the local state variables + const isSolved = gameState.isSolved === true; + const isFailed = gameState.isFailed === true; + + // Debug logging to understand the issue + if (typeof window !== 'undefined') { + console.log('[Game] State check:', { + gameStateIsSolved: gameState.isSolved, + gameStateIsFailed: gameState.isFailed, + gameStateTypeIsSolved: typeof gameState.isSolved, + gameStateTypeIsFailed: typeof gameState.isFailed, + guesses: gameState.guesses.length, + maxAttempts, + computedIsSolved: isSolved, + computedIsFailed: isFailed, + willShowInput: !isSolved && !isFailed, + willShowResult: isSolved || isFailed + }); + } const handleGuess = (song: any) => { if (isProcessingGuess) return;