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.

Reinitializing with enableReinitialize doesn't clear form-level validation errors

See original GitHub issue

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

When using a form with enableReinitialize: true, if submit validation fails and logs a form-level error via the _error key, then the next time I reinitialize the form by changing the initial values, I would expect the form-level submission error to be cleared. It isn’t.

See https://www.webpackbin.com/bins/-Kh7QD0f8TITwxsbbian for a demo. Changing the counter will change the initial values, which clears the field-level errors but not the form-level error.

What is the expected behavior?

Reinitializing an enableReinitialize: true form by changing its initial values should clear form-level errors.

What’s your environment?

Observed in Redux Form 6.3.2, Windows 10, Chrome 57, Node 7.8, although I’ve reproduced in other environments too.

Other informations

This appears to be the result of is a result of changes in #2142 and #2228. If I understand the motivations there correctly, that was intended to handle the particular case where initialize is called with current form data. I’m not familiar enough with redux-form’s design to know the proper fix. Should the changes from #2228 be extended to only preserve warnings and errors of the initial values are identical? Is there a way to clear submission errors (which arguably should always be cleared) from sync and async warnings/errors (which could be kept)?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:11
  • Comments:6

github_iconTop GitHub Comments

1reaction
klasecommented, Dec 6, 2017

This is still an issue with 7.1.2. Any progress?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging form validation in Pycharm - django - Stack Overflow
Looks like PyCharm calling "error" form property while trying to show form in "Variables" frame in "Debug" tool window. On BaseForm.__init__ ...
Read more >
Examples - Final Form Docs
Introduces field-level validation functions and demonstrates how to display errors next to fields using child render functions.
Read more >
Synchronous Validation Example - Redux Form
The first is to provide redux-form with a validation function that takes an object of form values and returns an object of errors....
Read more >
Reinitializing Formik State in 10 mins (enableReinitialize ...
In this video we will see how we can use enableReinitialize, resetForm and setValues to reset formik form state under 10 minutes.
Read more >
withFormik() | Formik
Even if your form is not receiving any props from its parent, use mapPropsToValues to initialize your forms empty state. validate?: (values: Values,...
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