From 96cc9db7d6adc8f0d73f7ea7b6f2f720418a0709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=B6rdle=20Bot?= Date: Thu, 4 Dec 2025 20:39:43 +0100 Subject: [PATCH] Fix: hasLost/hasWon korrekt beim Reload initialisieren --- components/Game.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/Game.tsx b/components/Game.tsx index a96c8a8..49058d6 100644 --- a/components/Game.tsx +++ b/components/Game.tsx @@ -49,8 +49,8 @@ export default function Game({ dailyPuzzle, genre = null, isSpecial = false, max const t = useTranslations('Game'); const locale = useLocale(); const { gameState, statistics, addGuess, giveUp, addReplay, addYearBonus, skipYearBonus } = useGameState(genre, maxAttempts, isSpecial); - const [hasWon, setHasWon] = useState(false); - const [hasLost, setHasLost] = useState(false); + const [hasWon, setHasWon] = useState(gameState?.isSolved ?? false); + const [hasLost, setHasLost] = useState(gameState?.isFailed ?? false); const [shareText, setShareText] = useState(`🔗 ${t('share')}`); const [lastAction, setLastAction] = useState<'GUESS' | 'SKIP' | null>(null); const [isProcessingGuess, setIsProcessingGuess] = useState(false); @@ -87,12 +87,12 @@ export default function Game({ dailyPuzzle, genre = null, isSpecial = false, max }, []); useEffect(() => { - if (gameState && dailyPuzzle) { + if (gameState) { setHasWon(gameState.isSolved); setHasLost(gameState.isFailed); // Show year modal if won but year not guessed yet and release year is available - if (gameState.isSolved && !gameState.yearGuessed && dailyPuzzle.releaseYear) { + if (gameState.isSolved && !gameState.yearGuessed && dailyPuzzle?.releaseYear) { setShowYearModal(true); } }