Fix: Verbesserte Logik für Ergebnisanzeige bei zurückkehrenden Rätseln + Debug-Logs
- Verwende explizite === true Prüfung für isSolved/isFailed - Hinzugefügte Debug-Logs um State-Werte zu überprüfen - Zeigt gameState.isSolved/isFailed, Typen und berechnete Werte - Hilft beim Debuggen, warum Ergebnisanzeige nicht angezeigt wird
This commit is contained in:
+19
-2
@@ -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
|
// 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
|
// 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
|
// This ensures that when returning to a completed puzzle, the result is shown immediately
|
||||||
const isSolved = Boolean(gameState.isSolved);
|
// IMPORTANT: Check gameState.isSolved/isFailed directly, not the local state variables
|
||||||
const isFailed = Boolean(gameState.isFailed);
|
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) => {
|
const handleGuess = (song: any) => {
|
||||||
if (isProcessingGuess) return;
|
if (isProcessingGuess) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user