Skip to content

Commit c4195cd

Browse files
committed
fix: prevent NaN in stage output (#1139)
1 parent 8ed9430 commit c4195cd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/utils/deployStages.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ function round(value: number, precision: number): number {
3434
}
3535

3636
function formatProgress(current: number, total: number): string {
37+
if (total === 0) {
38+
return '0/0 (0%)';
39+
}
40+
3741
return `${current}/${total} (${round((current / total) * 100, 0)}%)`;
3842
}
3943

@@ -111,11 +115,12 @@ export class DeployStages {
111115
{
112116
label: 'Members',
113117
get: (data): string | undefined =>
114-
data?.sourceMemberPolling &&
115-
formatProgress(
116-
data.sourceMemberPolling.original - data.sourceMemberPolling.remaining,
117-
data.sourceMemberPolling.original
118-
),
118+
data?.sourceMemberPolling?.original
119+
? formatProgress(
120+
data.sourceMemberPolling.original - data.sourceMemberPolling.remaining,
121+
data.sourceMemberPolling.original
122+
)
123+
: undefined,
119124
stage: 'Updating Source Tracking',
120125
type: 'dynamic-key-value',
121126
},

0 commit comments

Comments
 (0)