Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] - Issue with Email Validation and API Call Trigger on Login #7510 #7596

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export const SignInUpForm = () => {
if (signInUpStep === SignInUpStep.Init) {
continueWithEmail();
} else if (signInUpStep === SignInUpStep.Email) {
if (form?.formState?.errors?.email) {
setShowErrors(true);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider moving this validation logic to the continueWithCredentials function for better separation of concerns.

continueWithCredentials();
} else if (signInUpStep === SignInUpStep.Password) {
if (!form.formState.isSubmitting) {
Expand Down Expand Up @@ -107,7 +111,9 @@ export const SignInUpForm = () => {

const isEmailStepSubmitButtonDisabledCondition =
signInUpStep === SignInUpStep.Email &&
(form.watch('email')?.length === 0 || shouldWaitForCaptchaToken);
(form.watch('email')?.length === 0 ||
Boolean(form?.formState?.errors?.email) ||
shouldWaitForCaptchaToken);

// TODO: isValid is actually a proxy function. If it is not rendered the first time, react might not trigger re-renders
// We make the isValid check synchronous and update a reactState to make sure this does not happen
Expand Down Expand Up @@ -179,6 +185,9 @@ export const SignInUpForm = () => {
onBlur={onBlur}
onChange={(value: string) => {
onChange(value);
if (form?.formState?.errors?.email) {
setShowErrors(true);
}
if (signInUpStep === SignInUpStep.Password) {
continueWithEmail();
}
Expand Down
Loading