From a3abc29f517322b337bf204e275bbcca4ec1fefa Mon Sep 17 00:00:00 2001 From: regexowl Date: Mon, 12 Aug 2024 10:21:44 +0200 Subject: [PATCH] Wizard: Add eslint-disable to useEffect This disables `react-hooks/exhaustive-deps` rule for dependency arrays that should run only once on mount and therefore need to stay empty. --- src/Components/CreateImageWizard/steps/Details/index.tsx | 3 +++ src/Components/CreateImageWizard/steps/Oscap/index.tsx | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/Components/CreateImageWizard/steps/Details/index.tsx b/src/Components/CreateImageWizard/steps/Details/index.tsx index 1d7d5fae..1e2b15f7 100644 --- a/src/Components/CreateImageWizard/steps/Details/index.tsx +++ b/src/Components/CreateImageWizard/steps/Details/index.tsx @@ -40,6 +40,9 @@ const DetailsStep = () => { ) ); } + // This useEffect hook should run *only* on mount and therefore has an empty + // dependency array. eslint's exhaustive-deps rule does not support this use. + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const handleNameChange = ( _event: React.FormEvent, diff --git a/src/Components/CreateImageWizard/steps/Oscap/index.tsx b/src/Components/CreateImageWizard/steps/Oscap/index.tsx index 0deed809..68279558 100644 --- a/src/Components/CreateImageWizard/steps/Oscap/index.tsx +++ b/src/Components/CreateImageWizard/steps/Oscap/index.tsx @@ -18,6 +18,9 @@ const OscapStep = () => { const release = useAppSelector(selectDistribution); useEffect(() => { prefetchOscapProfile({ distribution: release }); + // This useEffect hook should run *only* on mount and therefore has an empty + // dependency array. eslint's exhaustive-deps rule does not support this use. + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return (