question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possible regression in 7.2

See original GitHub issue

Describe 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

  • JS Template
  • TS Template

V6

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ddolcimascolocommented, Apr 21, 2021

@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

1reaction
NickR49commented, Apr 20, 2021

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found