Explorar el Código

Merge pull request #2248 from porter-dev/staging

Fix expanded job chart -> production
abelanger5 hace 3 años
padre
commit
e21d0dba74

+ 8 - 3
dashboard/src/main/home/cluster-dashboard/expanded-chart/useStackEnvGroups.ts

@@ -49,8 +49,13 @@ export const useStackEnvGroups = (chart: ChartType) => {
       .then((res) => res.data);
 
   useEffect(() => {
-    const stack_id = chart.stack_id;
+    const stack_id = chart?.stack_id;
     if (!stack_id) {
+      // if the chart has been loaded and the chart doesn't have a stack id, set loading to false
+      if (loading && chart) {
+        setLoading(false);
+      }
+
       return;
     }
     setLoading(true);
@@ -64,10 +69,10 @@ export const useStackEnvGroups = (chart: ChartType) => {
       .catch((error) => {
         setCurrentError(error);
       });
-  }, [chart.stack_id]);
+  }, [chart?.stack_id]);
 
   return {
-    isStack: chart.stack_id?.length ? true : false,
+    isStack: chart?.stack_id?.length ? true : false,
     stackEnvGroups,
     isLoadingStackEnvGroups: loading,
   };