fix: clear workspace name validation on field dirty (#10927)

This commit is contained in:
Kira Pilot
2023-11-29 10:53:45 -05:00
committed by GitHub
parent cb6c0f3cbb
commit 88f4490ad6
2 changed files with 5 additions and 1 deletions
@@ -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"