mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-21 06:02:37 -05:00
refactor(client): remove unnecessary useEffect (#57397)
This commit is contained in:
committed by
GitHub
parent
24abd4d9fc
commit
e11152d60b
@@ -177,7 +177,9 @@ function ShowCodeAlly(props: ShowCodeAllyProps) {
|
||||
});
|
||||
challengeMounted(challengeMeta.id);
|
||||
container.current?.focus();
|
||||
}, [props]); // TODO: split props, so that it doesn't rerender on every prop change
|
||||
// This effect should be run once on mount
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const openGitpod = (userToken?: string) => {
|
||||
const {
|
||||
|
||||
@@ -124,23 +124,6 @@ const ShowFillInTheBlank = ({
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
updateChallengeMeta({
|
||||
...challengeMeta,
|
||||
title,
|
||||
challengeType,
|
||||
helpCategory
|
||||
});
|
||||
challengeMounted(challengeMeta.id);
|
||||
}, [
|
||||
title,
|
||||
challengeMeta,
|
||||
challengeType,
|
||||
helpCategory,
|
||||
challengeMounted,
|
||||
updateChallengeMeta
|
||||
]);
|
||||
|
||||
const handleSubmit = () => {
|
||||
const blankAnswers = fillInTheBlank.blanks.map(b => b.answer);
|
||||
|
||||
|
||||
@@ -117,23 +117,6 @@ const ShowGeneric = ({
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
updateChallengeMeta({
|
||||
...challengeMeta,
|
||||
title,
|
||||
challengeType,
|
||||
helpCategory
|
||||
});
|
||||
challengeMounted(challengeMeta.id);
|
||||
}, [
|
||||
title,
|
||||
challengeMeta,
|
||||
challengeType,
|
||||
helpCategory,
|
||||
challengeMounted,
|
||||
updateChallengeMeta
|
||||
]);
|
||||
|
||||
// video
|
||||
const [videoIsLoaded, setVideoIsLoaded] = useState(false);
|
||||
|
||||
|
||||
@@ -202,23 +202,6 @@ const ShowQuiz = ({
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
updateChallengeMeta({
|
||||
...challengeMeta,
|
||||
title,
|
||||
challengeType,
|
||||
helpCategory
|
||||
});
|
||||
challengeMounted(challengeMeta.id);
|
||||
}, [
|
||||
title,
|
||||
challengeMeta,
|
||||
challengeType,
|
||||
helpCategory,
|
||||
challengeMounted,
|
||||
updateChallengeMeta
|
||||
]);
|
||||
|
||||
const handleFinishQuiz = () => {
|
||||
setShowUnanswered(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user