diff --git a/src/exams/Level/TextComponent.tsx b/src/exams/Level/TextComponent.tsx index fa2b0f66..367427c8 100644 --- a/src/exams/Level/TextComponent.tsx +++ b/src/exams/Level/TextComponent.tsx @@ -99,14 +99,17 @@ const TextComponent: React.FC = ({part, contextWord, setContextWordLine}) }); if (textRef.current) { + // eslint-disable-next-line react-hooks/exhaustive-deps resizeObserver.observe(textRef.current); } return () => { if (textRef.current) { + // eslint-disable-next-line react-hooks/exhaustive-deps resizeObserver.unobserve(textRef.current); } }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [part.context, contextWord]); /*if (typeof part.showContextLines === "undefined") { diff --git a/src/exams/Level/index.tsx b/src/exams/Level/index.tsx index cc71b2d1..94b2d4be 100644 --- a/src/exams/Level/index.tsx +++ b/src/exams/Level/index.tsx @@ -53,7 +53,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = if (showSolutions && exerciseIndex && userSolutions[exerciseIndex].shuffleMaps) { setShuffleMaps(userSolutions[exerciseIndex].shuffleMaps as ShuffleMap[]) } - }, [showSolutions]) + }, [showSolutions, exerciseIndex, setShuffleMaps, userSolutions]) useEffect(() => { if (hasExamEnded && exerciseIndex === -1) { @@ -99,6 +99,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = setShuffleMaps(newShuffleMaps); } else { + console.log("retrieving shuffles"); exercise.questions = exercise.questions.map(question => { const questionShuffleMap = shuffleMaps.find(map => map.id === question.id); if (questionShuffleMap) { @@ -148,6 +149,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = if (exerciseIndex !== -1) { setCurrentExercise(getExercise()); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [partIndex, exerciseIndex, shuffleMaps, exam.parts[partIndex].context]); @@ -173,6 +175,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = setContextWord(undefined); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentExercise, storeQuestionIndex]); const nextExercise = (solution?: UserSolution) => { @@ -269,6 +272,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = if (exerciseIndex === -1) { nextExercise() } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [exerciseIndex]) const calculateExerciseIndex = () => { diff --git a/src/pages/(exam)/ExamPage.tsx b/src/pages/(exam)/ExamPage.tsx index 20fad5c6..36df63e7 100644 --- a/src/pages/(exam)/ExamPage.tsx +++ b/src/pages/(exam)/ExamPage.tsx @@ -287,7 +287,7 @@ export default function ExamPage({page}: Props) { if(exam && exam.module === "level" && exam.parts[0].intro && !showSolutions) { setBgColor("bg-ielts-level-light"); } - }, [exam]) + }, [exam, showSolutions, setBgColor]) const checkIfStatsHaveBeenEvaluated = (ids: string[]) => { setTimeout(async () => {