diff --git a/src/utils/deployStages.ts b/src/utils/deployStages.ts index 10f21f23..1fd6f71e 100644 --- a/src/utils/deployStages.ts +++ b/src/utils/deployStages.ts @@ -32,6 +32,10 @@ function round(value: number, precision: number): number { } function formatProgress(current: number, total: number): string { + if (total === 0) { + return '0/0 (0%)'; + } + return `${current}/${total} (${round((current / total) * 100, 0)}%)`; } @@ -99,11 +103,12 @@ export class DeployStages { { label: 'Members', get: (data): string | undefined => - data?.sourceMemberPolling && - formatProgress( - data.sourceMemberPolling.original - data.sourceMemberPolling.remaining, - data.sourceMemberPolling.original - ), + data?.sourceMemberPolling?.original + ? formatProgress( + data.sourceMemberPolling.original - data.sourceMemberPolling.remaining, + data.sourceMemberPolling.original + ) + : undefined, stage: 'Updating Source Tracking', type: 'dynamic-key-value', },