Replace useEffect with useLayoutEffect in QuizRunner.tsx for currentIndex and showResult updates

This commit is contained in:
2026-01-08 02:16:37 +01:00
parent ef6fd3bb84
commit 745c577203

View File

@@ -389,7 +389,7 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt
} }
}; };
useEffect(() => { useLayoutEffect(() => {
if (status !== 'running') return; if (status !== 'running') return;
const saved = history[currentIndex]; const saved = history[currentIndex];
if (saved) { if (saved) {
@@ -403,7 +403,7 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt
} }
}, [currentIndex, history, status]); }, [currentIndex, history, status]);
useEffect(() => { useLayoutEffect(() => {
if (!showResult) return; if (!showResult) return;
setHistory((prev) => { setHistory((prev) => {
const next = [...prev]; const next = [...prev];