Skip to content

[Catalyst 1677] Dont reset login form data#2819

Merged
jamesqquick merged 6 commits intocanaryfrom
CATALYST-1677-dont-reset-login-form-data
Jan 14, 2026
Merged

[Catalyst 1677] Dont reset login form data#2819
jamesqquick merged 6 commits intocanaryfrom
CATALYST-1677-dont-reset-login-form-data

Conversation

@jamesqquick
Copy link
Contributor

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 /login and 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 the onSubmission callback to ensure default resetting of form data doesn't not happen in the sign up form.

const [form, fields] = useForm({
  //...
  onSubmit(event, { formData }) {
    event.preventDefault();
    startTransition(() => {
      formAction(formData);
    });
  }
});

@jamesqquick jamesqquick requested a review from a team as a code owner January 9, 2026 21:32
@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2026

🦋 Changeset detected

Latest commit: b62f857

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Patch

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

@vercel
Copy link

vercel bot commented Jan 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
catalyst Ready Ready Preview, Comment Jan 13, 2026 6:17pm

Copy link
Contributor

@matthewvolk matthewvolk left a comment

Choose a reason for hiding this comment

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

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();
Copy link
Contributor

Choose a reason for hiding this comment

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

🍹 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to remove passing the action!

@jamesqquick jamesqquick added this pull request to the merge queue Jan 14, 2026
Merged via the queue into canary with commit a1f1ed8 Jan 14, 2026
8 checks passed
@jamesqquick jamesqquick deleted the CATALYST-1677-dont-reset-login-form-data branch January 14, 2026 16:47
jamesqquick added a commit that referenced this pull request Feb 11, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants