Forgot to save TextComponent, and cleanup some warnings

This commit is contained in:
Carlos Mesquita
2024-08-20 20:02:59 +01:00
parent 30da295c60
commit 2e699d7e25
3 changed files with 9 additions and 2 deletions

View File

@@ -99,14 +99,17 @@ const TextComponent: React.FC<Props> = ({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") {

View File

@@ -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 = () => {