[Catalyst 1677] Dont reset login form data#2819
Conversation
🦋 Changeset detectedLatest commit: b62f857 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
matthewvolk
left a comment
There was a problem hiding this comment.
Looks good, if you don't mind double checking my comment below that would be awesome!
| shouldValidate: 'onBlur', | ||
| shouldRevalidate: 'onInput', | ||
| onSubmit(event, { formData }) { | ||
| event.preventDefault(); |
There was a problem hiding this comment.
🍹 I could be wrong, but I think preventDefault() allows us to remove the action={formAction} attribute on the form element below. Since we're now calling it here in onSubmit, I think the action prop is redundant. Double check me on that.
There was a problem hiding this comment.
Updated to remove passing the action!
* Add preventDefault to login form to prevent resetting of form on failed login attempt * added changeset * remove passing of action to form since actions is called manually in onSubmit handler
What/Why?
Don't reset login form data on a failed login attempt. This way the user doesn't have to enter their email address again from scratch,
Testing
Navigate to
/loginand attempt to login with invalid credentials. You should see an error message but the form data should be maintained.CleanShot.2026-01-09.at.15.31.36.mp4
Migration
Added a call to
event.preventDefault()in theonSubmissioncallback to ensure default resetting of form data doesn't not happen in the sign up form.