Skip to content

Commit

Permalink
only fetch default depl target if on v2 (#3712)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianedwards authored Oct 2, 2023
1 parent 03d5b33 commit 0e74c11
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dashboard/src/lib/hooks/useDeploymentTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export function useDefaultDeploymentTarget() {
["getDefaultDeploymentTarget", currentProject?.id, currentCluster?.id],
async () => {
// see Context.tsx L98 for why the last check is necessary
if (!currentProject?.id || !currentCluster?.id || currentCluster.id === -1) {
if (
!currentProject?.id ||
!currentCluster?.id ||
currentCluster.id === -1
) {
return;
}
const res = await api.getDefaultDeploymentTarget(
Expand All @@ -35,7 +39,10 @@ export function useDefaultDeploymentTarget() {
return deploymentTargetValidator.parseAsync(res.data);
},
{
enabled: !!currentProject && !!currentCluster,
enabled:
!!currentProject &&
!!currentCluster &&
currentProject.validate_apply_v2,
}
);

Expand Down

0 comments on commit 0e74c11

Please sign in to comment.