Skip to content

Commit

Permalink
Merge pull request #1419 from bipuladh/fix-rerender
Browse files Browse the repository at this point in the history
Fixes Create LVS re-render issue
  • Loading branch information
openshift-merge-bot[bot] authored Jun 7, 2024
2 parents 654e415 + 42f190a commit 6af8b0f
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
createLocalVolumeDiscovery,
updateLocalVolumeDiscovery,
} from '@odf/core/utils';
import { getNamespace } from '@odf/shared';
import { ErrorAlert } from '@odf/shared/generic/Error';
import { LoadingInline } from '@odf/shared/generic/Loading';
import { useFetchCsv } from '@odf/shared/hooks/use-fetch-csv';
Expand Down Expand Up @@ -324,16 +325,20 @@ export const CreateLocalVolumeSet: React.FC<CreateLocalVolumeSetProps> = ({
allNodes.current = createWizardNodeState(nonTaintedNodes);
}, [rawNodes]);

const shouldStartDiscovery =
!csvLoadError && csvLoaded && allNodes.current.length;
const csvNamespace = getNamespace(csv);

React.useEffect(() => {
if (!csvLoadError && csvLoaded && allNodes.current.length) {
if (shouldStartDiscovery) {
initDiskDiscovery(
allNodes.current,
csv?.metadata.namespace,
csvNamespace,
setLvdError,
setLvdInProgress
);
}
}, [csv, csvLoadError, csvLoaded, rawNodes]);
}, [csvNamespace, shouldStartDiscovery]);

const discoveriesLoaded =
csvLoaded &&
Expand Down

0 comments on commit 6af8b0f

Please sign in to comment.