Skip to content

Commit 88f4490

Browse files
authored
fix: clear workspace name validation on field dirty (coder#10927)
1 parent cb6c0f3 commit 88f4490

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ const CreateWorkspacePage: FC = () => {
127127
defaultOwner={me}
128128
defaultBuildParameters={defaultBuildParameters}
129129
error={createWorkspaceMutation.error}
130+
resetMutation={createWorkspaceMutation.reset}
130131
template={templateQuery.data!}
131132
versionId={realizedVersionId}
132133
externalAuth={externalAuth ?? []}

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export const Language = {
4646
export interface CreateWorkspacePageViewProps {
4747
mode: CreateWorkspaceMode;
4848
error: unknown;
49+
resetMutation: () => void;
4950
defaultName: string;
5051
defaultOwner: TypesGen.User;
5152
template: TypesGen.Template;
@@ -67,6 +68,7 @@ export interface CreateWorkspacePageViewProps {
6768
export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
6869
mode,
6970
error,
71+
resetMutation,
7072
defaultName,
7173
defaultOwner,
7274
template,
@@ -157,7 +159,8 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
157159
<TextField
158160
{...getFieldHelpers("name")}
159161
disabled={creatingWorkspace}
160-
onChange={onChangeTrimmed(form)}
162+
// resetMutation facilitates the clearing of validation errors
163+
onChange={onChangeTrimmed(form, resetMutation)}
161164
autoFocus
162165
fullWidth
163166
label="Workspace Name"

0 commit comments

Comments
 (0)