Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee605b3

Browse files
authored
fix: Don't show progress bar for new templates (#5298)
1 parent f7467ca commit ee605b3

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.stories.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,21 @@ Starting.args = {
3939
},
4040
}
4141

42+
// When the transition stats are returning null, the progress bar should not be
43+
// displayed
4244
export const StartingUnknown = Template.bind({})
4345
StartingUnknown.args = {
4446
...Starting.args,
45-
transitionStats: undefined,
47+
transitionStats: {
48+
// HACK: the codersdk type generator doesn't support null values, but this
49+
// can be null when the template is new.
50+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Read comment above
51+
// @ts-ignore-error
52+
P50: null,
53+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Read comment above
54+
// @ts-ignore-error
55+
P95: null,
56+
},
4657
}
4758

4859
export const StartingPassedEstimate = Template.bind({})

site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
102102
setTimeout(updateProgress, 5)
103103
}, [progressValue, job, transitionStats])
104104

105+
// HACK: the codersdk type generator doesn't support null values, but this
106+
// can be null when the template is new.
107+
if ((transitionStats.P50 as number | null) === null) {
108+
return <></>
109+
}
105110
return (
106111
<div className={styles.stack}>
107112
<LinearProgress

0 commit comments

Comments
 (0)