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: isValidating remains true by triggering form in a useEffect #11622

Closed
1 task done
adguernier opened this issue Mar 12, 2024 · 3 comments
Closed
1 task done

issue: isValidating remains true by triggering form in a useEffect #11622

adguernier opened this issue Mar 12, 2024 · 3 comments

Comments

@adguernier
Copy link

adguernier commented Mar 12, 2024

Version Number

7.51.0

Codesandbox/Expo snack

https://codesandbox.io/p/sandbox/react-hook-form-pending-validating-tgsnvt

Steps to reproduce

  1. Go to the Codesandbox
  2. Fill the firstName input
  3. See that isValid is false and isValidating remains true
  4. Fill the lastName input
  5. See that isValid becomes true but isValidating remains true

Expected behaviour

It happens since the v7.51.0, might be introduced by #10657. In the previous version, isValidating became false after the validation process, which seems to make sense.

What seems to be causing this issue here is triggering validation in a useEffect, however, for technical reasons we need to do this in our project:

// in the <Toolbar> component
React.useEffect(() => {
  trigger();
}, []);

What browsers are you seeing the problem on?

Firefox, Chrome

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@adguernier adguernier changed the title issue: isValidating remains true while triggering form in a useEffect issue: isValidating remains true by triggering form in a useEffect Mar 12, 2024
@bluebill1049
Copy link
Member

thanks this should be fixed already: #11613 in th next release

@MariaTolstov
Copy link

It is fixed in the latest release when trigger() is used for all fields, but for a specific field ( trigger("fieldName") ) isValidating still returns true.

@bluebill1049
Copy link
Member

It is fixed in the latest release when trigger() is used for all fields, but for a specific field ( trigger("fieldName") ) isValidating still returns true.

create an issue with reproducible codesadnbox and steps to reproduce

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants