mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: clear workspace name validation on field dirty (#10927)
This commit is contained in:
@@ -127,6 +127,7 @@ const CreateWorkspacePage: FC = () => {
|
||||
defaultOwner={me}
|
||||
defaultBuildParameters={defaultBuildParameters}
|
||||
error={createWorkspaceMutation.error}
|
||||
resetMutation={createWorkspaceMutation.reset}
|
||||
template={templateQuery.data!}
|
||||
versionId={realizedVersionId}
|
||||
externalAuth={externalAuth ?? []}
|
||||
|
||||
@@ -46,6 +46,7 @@ export const Language = {
|
||||
export interface CreateWorkspacePageViewProps {
|
||||
mode: CreateWorkspaceMode;
|
||||
error: unknown;
|
||||
resetMutation: () => void;
|
||||
defaultName: string;
|
||||
defaultOwner: TypesGen.User;
|
||||
template: TypesGen.Template;
|
||||
@@ -67,6 +68,7 @@ export interface CreateWorkspacePageViewProps {
|
||||
export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
|
||||
mode,
|
||||
error,
|
||||
resetMutation,
|
||||
defaultName,
|
||||
defaultOwner,
|
||||
template,
|
||||
@@ -157,7 +159,8 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
|
||||
<TextField
|
||||
{...getFieldHelpers("name")}
|
||||
disabled={creatingWorkspace}
|
||||
onChange={onChangeTrimmed(form)}
|
||||
// resetMutation facilitates the clearing of validation errors
|
||||
onChange={onChangeTrimmed(form, resetMutation)}
|
||||
autoFocus
|
||||
fullWidth
|
||||
label="Workspace Name"
|
||||
|
||||
Reference in New Issue
Block a user