Skip to content

Commit

Permalink
latest code
Browse files Browse the repository at this point in the history
  • Loading branch information
RajuGangitla committed Oct 18, 2024
1 parent 0dfa31b commit c3dab41
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const formSchema = z.object({
name: z
.string()
.min(3)
.refine((v) => validCharactersRegex.test(v), {
message: "worksapce can only contain letters, numbers, dashes and underscores",
}),
.regex(validCharactersRegex, {
message: "Workspace can only contain letters, numbers, dashes, and underscores",
})
});

type Props = {
Expand Down Expand Up @@ -61,7 +61,7 @@ export const UpdateWorkspaceName: React.FC<Props> = ({ workspace }) => {
async function onSubmit(values: z.infer<typeof formSchema>) {
await updateName.mutateAsync(values);
}
const isDisabled = form.formState.isLoading || !form.formState.isValid;
const isDisabled = form.formState.isLoading || !form.formState.isValid || updateName.isLoading;
return (
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
Expand Down Expand Up @@ -92,7 +92,7 @@ export const UpdateWorkspaceName: React.FC<Props> = ({ workspace }) => {
<Button
variant={updateName.isLoading ? "disabled" : "primary"}
type="submit"
disabled={updateName.isLoading || isDisabled}
disabled={isDisabled}
>
{updateName.isLoading ? <Loading /> : "Save"}
</Button>
Expand Down

0 comments on commit c3dab41

Please sign in to comment.