diff --git a/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.stories.tsx b/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.stories.tsx index 23c9ecf1342f8..344828094807f 100644 --- a/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.stories.tsx +++ b/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.stories.tsx @@ -39,10 +39,21 @@ Starting.args = { }, } +// When the transition stats are returning null, the progress bar should not be +// displayed export const StartingUnknown = Template.bind({}) StartingUnknown.args = { ...Starting.args, - transitionStats: undefined, + transitionStats: { + // HACK: the codersdk type generator doesn't support null values, but this + // can be null when the template is new. + // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Read comment above + // @ts-ignore-error + P50: null, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Read comment above + // @ts-ignore-error + P95: null, + }, } export const StartingPassedEstimate = Template.bind({}) diff --git a/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.tsx b/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.tsx index 389f57e946728..ed38865f21e0b 100644 --- a/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.tsx +++ b/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.tsx @@ -102,6 +102,11 @@ export const WorkspaceBuildProgress: FC = ({ setTimeout(updateProgress, 5) }, [progressValue, job, transitionStats]) + // HACK: the codersdk type generator doesn't support null values, but this + // can be null when the template is new. + if ((transitionStats.P50 as number | null) === null) { + return <> + } return (