mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-02 22:55:33 +03:00
4809 - disable double signup with mouse click / enter (#4878)
Fixing #4809 The form has a button with a disabled condition, unfortunately there was an error in checking the condition. ``` disabled={ SignInUpStep.Init ? false ... ``` SignInUpStep.Init is always equal to true, so the first arm was returning false and button was never disabled. Fixing this check fixes the double mouse click bug as expected. ``` disabled={ signInUpStep === SignInUpStep.Init ``` Still, the enter keypress is handled a little bit differently. There is a handleKeyDown event that was ignoring if the form is submitting or not. I added the check for that, and now pressing enter multiple times does not result in any errors
This commit is contained in:
parent
bf60227d67
commit
ffda4058e0
@ -71,8 +71,10 @@ export const SignInUpForm = () => {
|
|||||||
} else if (signInUpStep === SignInUpStep.Email) {
|
} else if (signInUpStep === SignInUpStep.Email) {
|
||||||
continueWithCredentials();
|
continueWithCredentials();
|
||||||
} else if (signInUpStep === SignInUpStep.Password) {
|
} else if (signInUpStep === SignInUpStep.Password) {
|
||||||
setShowErrors(true);
|
if (!form.formState.isSubmitting) {
|
||||||
form.handleSubmit(submitCredentials)();
|
setShowErrors(true);
|
||||||
|
form.handleSubmit(submitCredentials)();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -225,7 +227,7 @@ export const SignInUpForm = () => {
|
|||||||
}}
|
}}
|
||||||
Icon={() => form.formState.isSubmitting && <Loader />}
|
Icon={() => form.formState.isSubmitting && <Loader />}
|
||||||
disabled={
|
disabled={
|
||||||
SignInUpStep.Init
|
signInUpStep === SignInUpStep.Init
|
||||||
? false
|
? false
|
||||||
: signInUpStep === SignInUpStep.Email
|
: signInUpStep === SignInUpStep.Email
|
||||||
? !form.watch('email')
|
? !form.watch('email')
|
||||||
|
Loading…
Reference in New Issue
Block a user