react-hook-form: formState.isValid does not work

Describe the bug Hey, I had to code a custom input and I found a problem when I use register in useEffect. When I use setValue the formState.isValid keeps false

Thats happened when I updated the component to version 3.28.x, at version 3.27 works

Codesandbox link https://codesandbox.io/s/affectionate-galois-1qgjl

Expected behavior formState.isValid should be true

Desktop:

  • OS: Archlinux and macOS X
  • Browser Firefox
  • Version 71.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 20 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Yep, everything works now! 🎊 🎊 🎊 🎊

thanks @sergiors that was my bad, i did a refactor on validate schema isValid and i have broken few things. sorry about that, but the refactor did clean up few things for long term.

try this beta, should fix it: 3.28.13-beta.1

So, if someone will need short answer.

You need to add { shouldValidate: true } as 3rd parameter.

Example: setValue('SomeFieldName', value, { shouldValidate: true });