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(() => {
|
||||
if (autoStart && entries.length > 0) {
|
||||
if (autoStart && status === 'setup' && entries.length > 0) {
|
||||
startQuiz();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [autoStart, defaultEntryId, entries.length]);
|
||||
}, [autoStart, defaultEntryId, entries.length, status]);
|
||||
|
||||
const currentQuestion = useMemo(() => questions[currentIndex], [questions, currentIndex]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user