From 64a393e5fb791e66ecba53c952a604c7ae87d264 Mon Sep 17 00:00:00 2001 From: Joaquim Rocha Date: Fri, 29 Sep 2023 14:05:07 +0100 Subject: [PATCH] frontend: Remove useless use of useClustersConf from useCluster I guess the original idea of having the useClustersConf trigger the check for useCluster was that maybe we have new configuration for any current cluster, but the truth is that the useCluster hook would anyway not fire because it depends on having a cluster name different from the one in the current URL, and that's not influenced by the useClustersConf. I.e. useClustersConf was triggering unnecessary checks within useCluster. --- frontend/src/lib/k8s/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/src/lib/k8s/index.ts b/frontend/src/lib/k8s/index.ts index 820e171bd4..58e388f308 100644 --- a/frontend/src/lib/k8s/index.ts +++ b/frontend/src/lib/k8s/index.ts @@ -109,14 +109,12 @@ export function useCluster() { const [cluster, setCluster] = React.useState(getClusterFromLocation()); - const clusters = useClustersConf(); - React.useEffect(() => { const currentCluster = getClusterFromLocation(); if (cluster !== currentCluster) { setCluster(currentCluster); } - }, [clusters, cluster, location]); + }, [cluster, location]); return cluster; }