Disable error on form state submitting
parent
6a37445c51
commit
2ffefcc97e
|
@ -49,7 +49,7 @@ function UsernameField({
|
|||
...props
|
||||
}: React.ComponentProps<typeof TextField> & { setPremium: (value: boolean) => void; premium: boolean }) {
|
||||
const { t } = useLocale();
|
||||
const { watch, setError, register } = useFormContext<FormValues>();
|
||||
const { watch, setError, register, formState } = useFormContext<FormValues>();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [taken, setTaken] = useState(false);
|
||||
const watchedUsername = watch("username");
|
||||
|
@ -85,6 +85,7 @@ function UsernameField({
|
|||
return (
|
||||
<div>
|
||||
<TextField {...props} {...register("username")} />
|
||||
{!formState.isSubmitting && (
|
||||
<div className="text-gray text-default flex items-center text-sm">
|
||||
<p className="flex items-center text-sm ">
|
||||
{loading ? (
|
||||
|
@ -107,6 +108,7 @@ function UsernameField({
|
|||
) : null}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue