Skip to content

Commit

Permalink
frontend: Memoize useClustersConf response
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Dubenko <[email protected]>
  • Loading branch information
sniok committed Dec 6, 2024
1 parent f30c213 commit 048e2ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/lib/k8s/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import React from 'react';
import React, { useMemo } from 'react';
import { matchPath, useLocation } from 'react-router-dom';
import { ConfigState } from '../../redux/configSlice';
import { useTypedSelector } from '../../redux/reducers/reducers';
Expand Down Expand Up @@ -94,7 +94,7 @@ export function useClustersConf(): ConfigState['allClusters'] {
Object.assign(allClusters, statelessClusters);
}

return allClusters;
return useMemo(() => allClusters, [Object.keys(allClusters).join(',')]);
}

export function useCluster() {
Expand Down

0 comments on commit 048e2ab

Please sign in to comment.