Parcourir la source

Fix useMemo position.

Based on hook rules, there cannot be a difference of hooks implemented between renders, that's caused by using
a hook under a return of the component
jnfrati il y a 4 ans
Parent
commit
5da12f2c84

+ 2 - 2
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedJobChart.tsx

@@ -281,6 +281,8 @@ export const ExpandedJobChartFC: React.FC<{
     return null;
   };
 
+  const formData = useMemo(() => cloneDeep(chart?.form || {}), [chart]);
+
   if (status === "loading") {
     return <Loading />;
   }
@@ -320,8 +322,6 @@ export const ExpandedJobChartFC: React.FC<{
     );
   }
 
-  const formData = useMemo(() => cloneDeep(chart.form), [chart]);
-
   return (
     <>
       <ConnectToJobInstructionsModal