|
|
@@ -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,
|
|
|
};
|