Possible regression in 7.2
See original GitHub issueDescribe the bug One of our tests started to fail when trying to upgrade this library to 7.2.0, then 7.2.1 and it kept failing. The test ensures that a field is in error state when an error condition triggers, then turn back to normal state when error condition is cleared.
To Reproduce
Nothing really fancy, except that we manually call setError(field) / clearErrors(field), i.e.: manual validation.
Codesandbox link (Required) I will try to provide a codesandbox later, but I do provide all the details above.
V7
V6
- useForm Template
- useFieldArray Template
- Controller Template
Expected behavior The test does not fail.
Desktop (please complete the following information):
- OS: Linux
- Browser: jsdom (jest tests)
- Version: latest
Additional context I see there’s a change regarding validation in 7.2, this might be related.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:11 (6 by maintainers)
Top Results From Across the Web
7.2: Simple Linear Regression - Statistics LibreTexts
A simple linear regression model is a mathematical equation that allows us to predict a response for a given predictor value. Our model...
Read more >Tutorial 7.2a - Simple linear regression
Regression is used to investigate the nature of a relationship between variables in which the magnitude and changes in one variable (known as ......
Read more >7.2 - Contrasts | STAT 555
7.2 - Contrasts ... A contrast is essentially a difference in regression coefficients. ... you have likely learned about main effects and interactions....
Read more >Application exercise 7.2: Multiple linear regression
Application exercise 7.2: Multiple linear regression ... STYLE: Some information of style of cigarette (not available for all cigarettes, and not used in ......
Read more >7 Multiple Regression | An Introduction to Statistical and Data ...
This case of regression more than one explanatory variable is known as multiple regression. You can imagine when trying to model a particular...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@bluebill1049 Sorry for the delay, I managed to reproduce in a CSB https://codesandbox.io/s/condescending-volhard-3xj87
Submit with an empty field, the field turns to error state. Type-in some characters, the error state does not automatically reset. If you change the version of RHF to 7.1.1 it resets.
I’m a bit confused now by our call to clearErrors that might not be required at all, but that’s another story 😕
David
@bluebill1049 I’ve fixed the issue I was having. It was where my component was doing an unnecessary call to clearErrors(name) before then calling setError(name) in the next render (my component in this case was meant to start in an error state). I didn’t think it would matter but this was causing my component to not be listed in the errors object. Removing the unnecessary call to clearErrors (even though it happened before setError) meant that it was correctly in the errors object.
CSB - https://codesandbox.io/s/dreamy-galileo-opyt3?file=/src/App.js
Update - oddly it’s indeterminate. Refresh the CSB a few times and sometimes the error shows correctly and sometimes it doesn’t