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