Skip to content

Commit

Permalink
frontend: Remove useless use of useClustersConf from useCluster
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joaquimrocha committed Sep 29, 2023
1 parent 9191b65 commit 64a393e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions frontend/src/lib/k8s/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,12 @@ export function useCluster() {

const [cluster, setCluster] = React.useState<string | null>(getClusterFromLocation());

const clusters = useClustersConf();

React.useEffect(() => {
const currentCluster = getClusterFromLocation();
if (cluster !== currentCluster) {
setCluster(currentCluster);
}
}, [clusters, cluster, location]);
}, [cluster, location]);

return cluster;
}
Expand Down

0 comments on commit 64a393e

Please sign in to comment.