npm final-form 5.0.1
v5.0.1

6 hours ago

v5.0.1

A big batch of bug fixes that have accumulated since the v5.0.0 release. No breaking changes.

New

  • ignoreUnregister config option — Fields that unregister will have their values ignored during validation and submission, without needing destroyOnUnmount. 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 getValidators encounters an undefined field (#532, fixes #158)

Submission

  • Fixed beforeSubmit not being called before the sync errors check — it can now prevent submission even when there are no sync errors (#522)
  • Fixed submitErrors being wiped when sync validation fails after a failed submission (#521, fixes #437)

Field State

  • Fixed keepDirtyOnReinitialize not working correctly with array fields (#538, fixes #366)
  • Fixed modified flag not being cleared after reset() / 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 initialValues not updating when a field's initialValue prop 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 setIn crashing on undefined state (#535, fixes #909)
  • Fixed inability to register fields with reserved property names like constructor (#520)

TypeScript

  • FormState.values is now correctly typed as non-optional (#502)
  • Fixed return type of submit function in type declarations (#499)
  • Fixed isEqual initialization TypeScript error (#517)
  • Added types field to package.json for better tooling compatibility (#518)
  • blur, change, and focus are now guaranteed to always be functions (#519, fixes #472)

Don't miss a new final-form release

NewReleases is sending notifications on new releases.