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

Add revalidateMode prop to Form #30

Closed
johnsonthedev opened this issue Jun 3, 2022 · 3 comments · Fixed by #125
Closed

Add revalidateMode prop to Form #30

johnsonthedev opened this issue Jun 3, 2022 · 3 comments · Fixed by #125
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@johnsonthedev
Copy link

johnsonthedev commented Jun 3, 2022

this is regarding: https://remix-forms.seasoned.cc/examples/actions/field-error

If I enter foo@bar.com and submit the form it returns with Email already taken. => Ok
If I change the email to foo the error changes to Invalid email without requiring a submit => not sure if this is a bug or a feature. I think it should only re-validate if I use mode="onChange"
If I now change the email to a valid one like remix@foo.com the old/cached error appears: Email already taken => Not Ok. I think this is confusing, as it might lead to the assumption that remix@foo.com is taken too.

My proposal would be to allow resetting errors

@danielweinmann
Copy link
Contributor

Thanks @johnsonthedev! My suggestion for this issue is:

  1. Add a revalidateMode prop to Form and pass it to react-hook-form's useForm. Right now, we're always using the onChange default for revalidation.

  2. Reset server-side errors upon revalidation.

How does that sound to you?

We'll work on this soon, but it probably won't be a top priority. Feel free to send a PR in the meantime :) thank you!

@gustavoguichard gustavoguichard added the good first issue Good for newcomers label Jul 27, 2022
@danielweinmann danielweinmann added bug Something isn't working and removed good first issue Good for newcomers labels Dec 8, 2022
@danielweinmann danielweinmann changed the title Add support to reset errors e.g. onFocus, onChange Add revalidateMode prop to Form Dec 8, 2022
@danielweinmann
Copy link
Contributor

We'll track the server-side revalidation on #111 and use this issue only for adding the revalidateMode to Form.

@danielweinmann danielweinmann added enhancement New feature or request good first issue Good for newcomers and removed bug Something isn't working labels Dec 8, 2022
@felipefreitag felipefreitag self-assigned this Dec 8, 2022
@danielweinmann
Copy link
Contributor

Released on v1.3.0. Thanks, @felipefreitag 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants