Ensure autoStart only triggers quiz if status is 'setup'
This commit is contained in:
@@ -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]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user