Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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: AJV resolvers custom keywords errors are not present in formState.errors #11890

Closed
1 task done
javier-brenes-zen opened this issue May 15, 2024 · 0 comments
Closed
1 task done

Comments

@javier-brenes-zen
Copy link

javier-brenes-zen commented May 15, 2024

Version Number

7.51.0

Codesandbox/Expo snack

https://stackblitz.com/edit/stackblitz-starters-vtxdst?file=src%2FApp.js,src%2FcustomKeywords.js

Steps to reproduce

  1. on stackblitz project go to customKeywords, there you will see cannotBeEqualTo definition and verify we are passing error.
  2. on inputs ( browser side ) add CR for state, and 123 for Plate
  3. you will noticed form is not valid due to cannotBeEqualTo validations
  4. check errors in console, I am expecting to see the error cannotBeEqualTo custom keyword produces but it is not there so I cannot give feedback to user.

Expected behaviour

I am expecting getting the error in formState.errors so I can use it to give feedback to the user, I already tested the Json schema using ajv directly and I am seeing the error being returned so it has to be something in React-hook-form that deletes the error or doesn't include it on the formState.errors.

AJV validation codesandbox: https://shhttps://shorturl.at/fgJQ3orturl.at/fgJQ3

Evidence:
I added some console.log at https://github.com/react-hook-form/resolvers/blob/master/ajv/src/ajv.ts locally so I guarantee error is being captured

Screenshot 2024-05-15 at 4 33 14 PM

and just after that this is what I get from react-hook-form on my app.

Screenshot 2024-05-15 at 4 37 15 PM

as you can see form is invalid but no errors come.

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@react-hook-form react-hook-form locked and limited conversation to collaborators May 19, 2024
@bluebill1049 bluebill1049 converted this issue into discussion #11899 May 19, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant