Reinitializing with enableReinitialize doesn't clear form-level validation errors
See original GitHub issueAre 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:
- Created 6 years ago
- Reactions:11
- Comments:6
Top GitHub Comments
Similar issues: https://github.com/erikras/redux-form/issues/2971#issuecomment-459311439 https://github.com/erikras/redux-form/issues/2814#issuecomment-459356655
This is still an issue with 7.1.2. Any progress?