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

issue: Resolver's return error should properly set formState: {error} #11800

Closed
1 task done
croraf opened this issue Apr 19, 2024 · 0 comments
Closed
1 task done

issue: Resolver's return error should properly set formState: {error} #11800

croraf opened this issue Apr 19, 2024 · 0 comments
Labels
duplicated duplicated issue

Comments

@croraf
Copy link

croraf commented Apr 19, 2024

Version Number

7.51.3

Codesandbox/Expo snack

https://codesandbox.io/p/sandbox/hungry-panini-cfycjl?file=%2Fsrc%2FApp.tsx%3A8%2C18

Steps to reproduce

  1. Submit form with empty fields
  2. Check the console. Both resolver's return and formState: errors will contain two error fields (firstName and lastName).
  3. The logic in the resolver is that at least one field is required.
  4. After one field is filled both errors should be cleared.
  5. Only respective error field is cleared.

Expected behaviour

It seems impossible to write a logic in the resolver to combine several fields where at least one satisfies some condition.

I understand there were similar bugs reported previously, such as #8819 but then how to implement this combined (with OR) logic in the resolver. This is very common requirement in the forms and current behavior seems very counter-intuitive.

What browsers are you seeing the problem on?

Firefox, Chrome, Safari, Edge

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@croraf croraf changed the title issue: Resolver's return error should set formState: {error} issue: Resolver's return error should properly set formState: {error} Apr 19, 2024
@bluebill1049 bluebill1049 added the duplicated duplicated issue label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicated duplicated issue
Projects
None yet
Development

No branches or pull requests

2 participants