Skip to content

Commit

Permalink
tidy conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
ianedwards committed May 1, 2024
1 parent eae37c1 commit 47863ac
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions dashboard/src/lib/porter-apps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,20 @@ export function serviceOverrides({
}

const predeploy = match({
overrides: overrides.predeploy,
predeployOverride: overrides.predeploy,
useDefaults,
})
.with(
{
overrides: P.nullish,
predeployOverride: P.nullish,
},
() => undefined
)
.with(
{
useDefaults: true,
},
() =>
({ predeployOverride }) =>
deserializeService({
service: defaultSerialized({
name: "pre-deploy",
Expand All @@ -266,19 +266,19 @@ export function serviceOverrides({
}),
override: serializedServiceFromProto({
service: new Service({
...overrides.predeploy,
...predeployOverride,
name: "pre-deploy",
}),
isPredeploy: true,
}),
expanded: true,
})
)
.otherwise(() =>
.otherwise(({ predeployOverride }) =>
deserializeService({
service: serializedServiceFromProto({
service: new Service({
...(overrides.predeploy ?? {}),
...predeployOverride,
name: "pre-deploy",
}),
isPredeploy: true,
Expand All @@ -287,20 +287,21 @@ export function serviceOverrides({
);

const initialDeploy = match({
overrides: overrides.initialDeploy,
initialDeployOverride: overrides.initialDeploy,
useDefaults,
})
.with(
{
overrides: P.nullish,
initialDeployOverride: P.nullish,
},
() => undefined
)
.with(
{
useDefaults: true,
initialDeployOverride: P.not(P.nullish),
},
() =>
({ initialDeployOverride }) =>
deserializeService({
service: defaultSerialized({
name: "initdeploy",
Expand All @@ -310,7 +311,7 @@ export function serviceOverrides({
}),
override: serializedServiceFromProto({
service: new Service({
...(overrides.initialDeploy ?? {}),
...initialDeployOverride,
name: "initdeploy",
}),
isPredeploy: false,
Expand All @@ -319,11 +320,11 @@ export function serviceOverrides({
expanded: true,
})
)
.otherwise(() =>
.otherwise(({ initialDeployOverride }) =>
deserializeService({
service: serializedServiceFromProto({
service: new Service({
...(overrides.initialDeploy ?? {}),
...(initialDeployOverride ?? {}),
name: "initdeploy",
}),
isInitdeploy: true,
Expand Down

0 comments on commit 47863ac

Please sign in to comment.