Skip to content

Commit 76f66ca

Browse files
committed
Chase down errors
1 parent 7fdc743 commit 76f66ca

File tree

11 files changed

+114
-25892
lines changed

11 files changed

+114
-25892
lines changed

site/package-lock.json

Lines changed: 0 additions & 25786 deletions
This file was deleted.

site/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"cron-parser": "4.5.0",
4040
"cronstrue": "2.11.0",
4141
"dayjs": "1.11.4",
42-
"formik": "2.2.9",
42+
"formik": "^2.2.9",
4343
"front-matter": "4.0.2",
4444
"history": "5.3.0",
4545
"just-debounce-it": "3.0.1",
@@ -49,7 +49,7 @@
4949
"react-markdown": "8.0.3",
5050
"react-router-dom": "6.3.0",
5151
"sourcemapped-stacktrace": "1.1.11",
52-
"swr": "1.2.2",
52+
"swr": "^1.3.0",
5353
"tzdata": "1.0.30",
5454
"uuid": "8.3.2",
5555
"xstate": "4.32.1",

site/src/components/ErrorBoundary/ErrorBoundary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Component, ReactNode } from "react"
1+
import React, { Component, ReactNode } from "react"
22
import { RuntimeErrorState } from "../RuntimeErrorState/RuntimeErrorState"
33

4-
type ErrorBoundaryProps = Record<string, unknown>
4+
type ErrorBoundaryProps = Record<string, any>
55

66
interface ErrorBoundaryState {
77
error: Error | null

site/src/components/FormTextField/FormTextField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export const FormTextField = <T,>({
134134
variant={variant}
135135
disabled={disabled || form.isSubmitting}
136136
error={isError}
137-
helperText={isError ? form.errors[formFieldName] : helperText}
137+
helperText={isError ? form.errors[formFieldName]?.toString() : helperText}
138138
id={fieldId}
139139
InputProps={isPassword ? undefined : InputProps}
140140
name={fieldId}

site/src/components/Resources/Resources.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const Resources: FC<React.PropsWithChildren<ResourcesProps>> = ({
4545
return (
4646
<div aria-label={Language.resources} className={styles.wrapper}>
4747
{getResourcesError ? (
48-
{ getResourcesError }
48+
getResourcesError.message
4949
) : (
5050
<TableContainer className={styles.tableContainer}>
5151
<Table>

site/src/components/SettingsAccountForm/SettingsAccountForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const AccountForm: FC<React.PropsWithChildren<AccountFormProps>> = ({
5151
<>
5252
<form onSubmit={form.handleSubmit}>
5353
<Stack>
54-
{updateProfileError && <ErrorSummary error={updateProfileError} />}
54+
{updateProfileError ? <ErrorSummary error={updateProfileError} /> : <></>}
5555
<TextField
5656
disabled
5757
fullWidth

site/src/components/SettingsSecurityForm/SettingsSecurityForm.tsx

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -68,40 +68,42 @@ export const SecurityForm: React.FC<React.PropsWithChildren<SecurityFormProps>>
6868
<>
6969
<form onSubmit={form.handleSubmit}>
7070
<Stack>
71-
{updateSecurityError && <ErrorSummary error={updateSecurityError} />}
72-
<TextField
73-
{...getFieldHelpers("old_password")}
74-
onChange={onChangeTrimmed(form)}
75-
autoComplete="old_password"
76-
fullWidth
77-
label={Language.oldPasswordLabel}
78-
variant="outlined"
79-
type="password"
80-
/>
81-
<TextField
82-
{...getFieldHelpers("password")}
83-
onChange={onChangeTrimmed(form)}
84-
autoComplete="password"
85-
fullWidth
86-
label={Language.newPasswordLabel}
87-
variant="outlined"
88-
type="password"
89-
/>
90-
<TextField
91-
{...getFieldHelpers("confirm_password")}
92-
onChange={onChangeTrimmed(form)}
93-
autoComplete="confirm_password"
94-
fullWidth
95-
label={Language.confirmPasswordLabel}
96-
variant="outlined"
97-
type="password"
98-
/>
71+
<>
72+
{updateSecurityError && <ErrorSummary error={updateSecurityError} />}
73+
<TextField
74+
{...getFieldHelpers("old_password")}
75+
onChange={onChangeTrimmed(form)}
76+
autoComplete="old_password"
77+
fullWidth
78+
label={Language.oldPasswordLabel}
79+
variant="outlined"
80+
type="password"
81+
/>
82+
<TextField
83+
{...getFieldHelpers("password")}
84+
onChange={onChangeTrimmed(form)}
85+
autoComplete="password"
86+
fullWidth
87+
label={Language.newPasswordLabel}
88+
variant="outlined"
89+
type="password"
90+
/>
91+
<TextField
92+
{...getFieldHelpers("confirm_password")}
93+
onChange={onChangeTrimmed(form)}
94+
autoComplete="confirm_password"
95+
fullWidth
96+
label={Language.confirmPasswordLabel}
97+
variant="outlined"
98+
type="password"
99+
/>
99100

100-
<div>
101-
<LoadingButton loading={isLoading} type="submit" variant="contained">
102-
{isLoading ? "" : Language.updatePassword}
103-
</LoadingButton>
104-
</div>
101+
<div>
102+
<LoadingButton loading={isLoading} type="submit" variant="contained">
103+
{isLoading ? "" : Language.updatePassword}
104+
</LoadingButton>
105+
</div>
106+
</>
105107
</Stack>
106108
</form>
107109
</>

site/src/components/Stack/Stack.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ export interface StackProps {
2929
direction?: Direction
3030
spacing?: number
3131
alignItems?: CSSProperties["alignItems"]
32+
children: React.ReactNode
3233
}
3334

34-
export const Stack: FC<React.PropsWithChildren<StackProps>> = ({
35+
export const Stack: FC<StackProps> = ({
3536
children,
3637
className,
3738
direction = "column",

site/src/components/WorkspaceScheduleForm/WorkspaceScheduleForm.tsx

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -214,70 +214,72 @@ export const WorkspaceScheduleForm: FC<React.PropsWithChildren<WorkspaceSchedule
214214
<FullPageForm onCancel={onCancel} title="Workspace schedule">
215215
<form onSubmit={form.handleSubmit} className={styles.form}>
216216
<Stack>
217-
{submitScheduleError && <ErrorSummary error={submitScheduleError} />}
218-
<TextField
219-
{...formHelpers("startTime", Language.startTimeHelperText)}
220-
disabled={isLoading}
221-
InputLabelProps={{
222-
shrink: true,
223-
}}
224-
label={Language.startTimeLabel}
225-
type="time"
226-
/>
217+
<>
218+
{submitScheduleError && <ErrorSummary error={submitScheduleError} />}
219+
<TextField
220+
{...formHelpers("startTime", Language.startTimeHelperText)}
221+
disabled={isLoading}
222+
InputLabelProps={{
223+
shrink: true,
224+
}}
225+
label={Language.startTimeLabel}
226+
type="time"
227+
/>
227228

228-
<TextField
229-
{...formHelpers("timezone")}
230-
disabled={isLoading}
231-
InputLabelProps={{
232-
shrink: true,
233-
}}
234-
label={Language.timezoneLabel}
235-
select
236-
>
237-
{zones.map((zone) => (
238-
<MenuItem key={zone} value={zone}>
239-
{zone}
240-
</MenuItem>
241-
))}
242-
</TextField>
229+
<TextField
230+
{...formHelpers("timezone")}
231+
disabled={isLoading}
232+
InputLabelProps={{
233+
shrink: true,
234+
}}
235+
label={Language.timezoneLabel}
236+
select
237+
>
238+
{zones.map((zone) => (
239+
<MenuItem key={zone} value={zone}>
240+
{zone}
241+
</MenuItem>
242+
))}
243+
</TextField>
243244

244-
<FormControl component="fieldset" error={Boolean(form.errors.monday)}>
245-
<FormLabel className={styles.daysOfWeekLabel} component="legend">
246-
{Language.daysOfWeekLabel}
247-
</FormLabel>
245+
<FormControl component="fieldset" error={Boolean(form.errors.monday)}>
246+
<FormLabel className={styles.daysOfWeekLabel} component="legend">
247+
{Language.daysOfWeekLabel}
248+
</FormLabel>
248249

249-
<FormGroup>
250-
{checkboxes.map((checkbox) => (
251-
<FormControlLabel
252-
control={
253-
<Checkbox
254-
checked={checkbox.value}
255-
disabled={isLoading}
256-
onChange={form.handleChange}
257-
name={checkbox.name}
258-
color="primary"
259-
size="small"
260-
disableRipple
261-
/>
262-
}
263-
key={checkbox.name}
264-
label={checkbox.label}
265-
/>
266-
))}
267-
</FormGroup>
250+
<FormGroup>
251+
{checkboxes.map((checkbox) => (
252+
<FormControlLabel
253+
control={
254+
<Checkbox
255+
checked={checkbox.value}
256+
disabled={isLoading}
257+
onChange={form.handleChange}
258+
name={checkbox.name}
259+
color="primary"
260+
size="small"
261+
disableRipple
262+
/>
263+
}
264+
key={checkbox.name}
265+
label={checkbox.label}
266+
/>
267+
))}
268+
</FormGroup>
268269

269-
{form.errors.monday && <FormHelperText>{Language.errorNoDayOfWeek}</FormHelperText>}
270-
</FormControl>
270+
{form.errors.monday && <FormHelperText>{Language.errorNoDayOfWeek}</FormHelperText>}
271+
</FormControl>
271272

272-
<TextField
273-
{...formHelpers("ttl", ttlShutdownAt(form.values.ttl), "ttl_ms")}
274-
disabled={isLoading}
275-
inputProps={{ min: 0, step: 1 }}
276-
label={Language.ttlLabel}
277-
type="number"
278-
/>
273+
<TextField
274+
{...formHelpers("ttl", ttlShutdownAt(form.values.ttl), "ttl_ms")}
275+
disabled={isLoading}
276+
inputProps={{ min: 0, step: 1 }}
277+
label={Language.ttlLabel}
278+
type="number"
279+
/>
279280

280-
<FormFooter onCancel={onCancel} isLoading={isLoading} />
281+
<FormFooter onCancel={onCancel} isLoading={isLoading} />
282+
</>
281283
</Stack>
282284
</form>
283285
</FullPageForm>

site/src/pages/UserSettingsPage/SSHKeysPage/SSHKeysPageView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,16 @@ export const SSHKeysPageView: FC<React.PropsWithChildren<SSHKeysPageViewProps>>
4141
<Stack>
4242
{/* Regenerating the key is not an option if getSSHKey fails.
4343
Only one of the error messages will exist at a single time */}
44-
{getSSHKeyError && <ErrorSummary error={getSSHKeyError} />}
45-
{regenerateSSHKeyError && (
44+
45+
{getSSHKeyError ? <ErrorSummary error={getSSHKeyError} /> : <></>}
46+
{regenerateSSHKeyError ? (
4647
<ErrorSummary
4748
error={regenerateSSHKeyError}
4849
defaultMessage={Language.errorRegenerateSSHKey}
4950
dismissible
5051
/>
52+
) : (
53+
<></>
5154
)}
5255
{hasLoaded && sshKey && (
5356
<>

site/yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7150,7 +7150,7 @@ format@^0.2.0:
71507150
resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b"
71517151
integrity sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=
71527152

7153-
formik@2.2.9:
7153+
formik@^2.2.9:
71547154
version "2.2.9"
71557155
resolved "https://registry.yarnpkg.com/formik/-/formik-2.2.9.tgz#8594ba9c5e2e5cf1f42c5704128e119fc46232d0"
71567156
integrity sha512-LQLcISMmf1r5at4/gyJigGn0gOwFbeEAlji+N9InZF6LIMXnFNkO42sCI8Jt84YZggpD4cPWObAZaxpEFtSzNA==
@@ -13122,10 +13122,10 @@ svgo@^2.7.0:
1312213122
picocolors "^1.0.0"
1312313123
stable "^0.1.8"
1312413124

13125-
swr@1.2.2:
13126-
version "1.2.2"
13127-
resolved "https://registry.yarnpkg.com/swr/-/swr-1.2.2.tgz#6cae09928d30593a7980d80f85823e57468fac5d"
13128-
integrity sha512-ky0BskS/V47GpW8d6RU7CPsr6J8cr7mQD6+do5eky3bM0IyJaoi3vO8UhvrzJaObuTlGhPl2szodeB2dUd76Xw==
13125+
swr@^1.3.0:
13126+
version "1.3.0"
13127+
resolved "https://registry.yarnpkg.com/swr/-/swr-1.3.0.tgz#c6531866a35b4db37b38b72c45a63171faf9f4e8"
13128+
integrity sha512-dkghQrOl2ORX9HYrMDtPa7LTVHJjCTeZoB1dqTbnnEDlSvN8JEKpYIYurDfvbQFUUS8Cg8PceFVZNkW0KNNYPw==
1312913129

1313013130
symbol-tree@^3.2.4:
1313113131
version "3.2.4"

0 commit comments

Comments
 (0)