v5.0.1
A big batch of bug fixes that have accumulated since the v5.0.0 release. No breaking changes.
New
ignoreUnregisterconfig option — Fields that unregister will have their values ignored during validation and submission, without needingdestroyOnUnmount. Useful for multi-step forms. (#500)
Bug Fixes
Validation
- Fixed async validation race condition — per-field async promises are now tracked individually so stale results from previous runs can't overwrite current ones (#513, fixes #509)
- Fixed infinite loop when an async validation promise rejects — the stale promise is now cleared so it can't retry forever (#530, fixes #166)
- Fixed validation not running correctly when a field has both array-level and item-level validators (#524, fixes #482)
- Fixed crash when a field is unregistered while validation is in-flight (#531, fixes #186)
- Fixed crash when
getValidatorsencounters an undefined field (#532, fixes #158)
Submission
- Fixed
beforeSubmitnot being called before the sync errors check — it can now prevent submission even when there are no sync errors (#522) - Fixed
submitErrorsbeing wiped when sync validation fails after a failed submission (#521, fixes #437)
Field State
- Fixed
keepDirtyOnReinitializenot working correctly with array fields (#538, fixes #366) - Fixed
modifiedflag not being cleared afterreset()/initialize()(#536, fixes #317) - Fixed dirty state not being tracked for unregistered FieldArray fields (#528, fixes #487)
- Fixed crash when unregistering a field that had been renamed (#533, fixes #191)
- Fixed
initialValuesnot updating when a field'sinitialValueprop changes (#543, fixes #988)
Values / setIn
- Fixed decimal, negative, and zero-padded numbers being treated as array indexes instead of object keys (e.g.,
values["1.5"]no longer becomes an array) (#526) - Fixed string error values being lost when removing nested field keys in
setIn(#527) - Fixed
setIncrashing onundefinedstate (#535, fixes #909) - Fixed inability to register fields with reserved property names like
constructor(#520)
TypeScript
FormState.valuesis now correctly typed as non-optional (#502)- Fixed return type of submit function in type declarations (#499)
- Fixed
isEqualinitialization TypeScript error (#517) - Added
typesfield topackage.jsonfor better tooling compatibility (#518) blur,change, andfocusare now guaranteed to always be functions (#519, fixes #472)