Ensure autoStart only triggers quiz if status is 'setup'

This commit is contained in:
2026-01-08 01:35:45 +01:00
parent 2c35387cf2
commit a60e37e9ad

View File

@@ -252,11 +252,11 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt
}, []); }, []);
useEffect(() => { useEffect(() => {
if (autoStart && entries.length > 0) { if (autoStart && status === 'setup' && entries.length > 0) {
startQuiz(); startQuiz();
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [autoStart, defaultEntryId, entries.length]); }, [autoStart, defaultEntryId, entries.length, status]);
const currentQuestion = useMemo(() => questions[currentIndex], [questions, currentIndex]); const currentQuestion = useMemo(() => questions[currentIndex], [questions, currentIndex]);