- Removed
defaultProps
as recommended by React
- Fixed
initialValues
not being cleared when optionsclearAfterSubmit
andsetInitialValuesOnSuccess
are bothtrue
- Fixed submit success not being updated when promise returned no result
- Added option
disableOnSubmit: boolean
touseForm()
- Added option
disableOnValidate: boolean
touseForm()
- Added option
setInitialValuesOnSuccess: boolean
touseForm()
- Fixed value not being read from target when using
handleChange()
- Fixed type of
errors[path]
to beError | undefined
instead ofError | void | undefined
inuseForm()
- Added attribute
name
to fields returned byuseFieldArray()
- Added
getButtonProps()
touseForm()
- Added
getFormProps()
touseForm()
- Fixed type attribute not being passed when custom component is used
- Fixed setting the value of a field whose parent is null
- Allow passing a function using current state in
setValues((current) => next)
, likeuseState()
- Fixed
form.touched
beingtrue
when callingsetTouchedFields()
with only falsy values - Upgraded dependencies
- Added
getFieldValue()
touseForm()
- Do not set form
validated
when validation starts - Fixed form
hasError
not being false in some cases - Fixed
validateFields()
to not dispatch fail state when validation succeeds - Fixed cases where field name resolution was not working
- Fixed update of previously defined values not being removed with
setValues()
- Fixed
useFieldArray()
not triggering rendering when array is modified
- Added option
parser(value): any
tohandleSetValue(name, options?)
returned byuseForm()
- Added
swap(from, to)
touseFieldArray()
- Allow passing several indexes to
remove()
inuseFieldArray()
- Fixed functions of
useFieldArray()
to queue updates when called during the same render - Fixed
submitted
not being set tofalse
when form is modified after submit - Upgraded dependencies
- Fixed some attributes (required, multiple) returned by
initializeField()
not used in<Field>
- Fixed select and textarea fields not updating on change
- Fixed validation not being debounced when modifying a field
- Fixed on debouncing
validate()
,validateField()
andvalidateFields()
- [BREAKING] Renamed component
<SelectOption />
to<Option />
- [BREAKING] Renamed option
onChange
totransform
inuseForm(options)
- [BREAKING] Renamed option
onLoad
toload
inuseForm(options)
- [BREAKING] Renamed option
onInitializeField
toinitializeField
inuseForm(options)
- [BREAKING] Renamed option
onValidate
tovalidate
inuseForm(options)
- [BREAKING] Renamed option
onValidateField
tovalidateField
inuseForm(options)
- [BREAKING] Renamed function
getAttributes(field: string)
togetFieldProps(field: name)
- [BREAKING] Renamed function
remove(field: string)
toremoveFields(fields: string[])
and - [BREAKING] Renamed function
initValues(values)
tosetInitialValues(values)
- [BREAKING] Changed
setErrors(errors, options?)
to set all errors at once, use optionpartial: true
to apply a partial update - [BREAKING] Changed
setValues(values, options?)
to set all values at once, use optionpartial: true
to apply a partial update - [BREAKING] Function
validateField(name: string)
returned byuseForm()
does not accept a value as second argument - [BREAKING] Do not call
removeField(name)
when<Field>
is unmounted - [BREAKING] Increment
submitCount
onsubmit()
and not on submit error - [BREAKING] Removed
loaded
fromuseForm()
- [BREAKING] Removed options
invalidClass
,modifiedClass
andvalidClass
inuseForm()
( the same result can be achieved withinitializeField()
) - Added option
formatter(value): string
to<Field>
- Added option
partial: boolean
tosetErrors(errors, options)
- Added option
partial: boolean
tosetValues(fields, options)
- Added option
validate: boolean
tosetTouchedFields(fields, options)
- Added option
validate: boolean
tosetValues(values, options)
- Added option
clearAfterSubmit: boolean
touseForm(options)
- Added option
debug: boolean
touseForm(options)
- Added option
onSubmitted()
touseForm(options)
- Added option
reinitialize: boolean
touseForm(options)
- Added option
trimOnBlur: boolean
touseForm(options)
- Added option
trimOnSubmit: boolean
touseForm(options)
- Added option
validateOnChange: boolean
touseForm(options)
- Added option
validateOnInit: boolean
touseForm(options)
- Added option
validateOnSubmit: boolean
touseForm(options)
- Added option
validateOnTouch: boolean
touseForm(options)
- Added
clear(fields?: string[])
touseForm()
- Added
clearErrors(fields?: string[])
touseForm()
- Added
clearTouchedFields(fields?: string[])
touseForm()
- Added
handleBlur(event)
touseForm()
- Added
handleReset(event)
touseForm()
- Added
handleSetValue(name)
touseForm()
- Added
load()
touseForm()
- Added
setTouchedField(name: string, touched: boolean)
touseForm()
- Added
setTouchedFields(fields: Record<string, boolean>, options?)
touseForm()
- Added
touched: boolean
touseForm()
- Added
touchedFields: string[]
touseForm()
- Pass form state as second argument of
initializeField(name: string, formState: FormState)
- Ignore modifications in
handleChange()
when form is disabled - Keep form disabled after validation if submission follows
- Improved behavior of error messages display when typing or submitting
- Fixed clearing errors of modified fields only
- Fixed parent form submission when submitting a nested form
- Fixed
modified
value returned byuseForm()
after removing a field - TypeScript declaration types
- [BREAKING] Initial values are not replaced after form submission (to get the same behaviour,
call
initValues(submittedValues)
) - [BREAKING] onValidateField() must return the Error instead of throwing it
- [BREAKING] Changed signature of onValidateField(value, name, values) to onValidateField(name, value, values)
- Added
onLoad()
option touseForm()
- Added
onChange()
option touseForm()
- Return
hasError: boolean
fromuseForm()
- Return
loading: boolean
fromuseForm()
- Return
loaded: boolean
fromuseForm()
- Return
loadError: Error
fromuseForm()
- Return
validateFields()
fromuseForm()
- Fixed
errors
returned byuseForm()
to not contain attributes withundefined
- Fixed ESM build
- Upgraded dependencies
- Fixed react missing key warnings in Field.js
- Upgraded dependencies
- Added support for react 17.x
- Fixed react missing key warnings in Field.js
- Removed "prop-types" from dependencies (still in peerDependencies)
- Fixed call of handleChange() with nothing as second argument
- Upgraded dependencies
- Upgraded dependencies
- Fixed error
performance is not defined
in nodejs env - Upgraded dependencies
- [BREAKING] Renamed attribute
changes
tomodifiedFields
returned fromuseForm()
- Allow to return a falsy value (e.g. null, false) during validation instead of an empty object, when there are no errors
- Automatically set attribute
id
on<Field>
using the name and value - Added export function
getFieldId(name, value)
to package - Added
nullify
option touseForm()
- Upgraded dependencies
- Upgraded dependencies
- [BREAKING] Removed attribute
validator
from<Field>
- [BREAKING] Removed functions
register()
andunregister()
returned fromuseForm()
- Added function
remove(name)
returned byuseForm()
as a replacement ofunregister()
- Added attribute
submitResult
returned byuseForm()
- Fixed infinite loop with anonymous functions passed as
validator
orparser
in<Field>
- Removed debounce on validate and submit
- Fixed infinite loop with
initialValues
inuseForm()
options - Fixed display of children in
<Field>
when the attributeoptions
is undefined and using a custom component - Fixed React warnings of duplicate keys when using attribute
options
in<Field>
- Added attribute
initialized
returned byuseForm()
- Upgraded dependencies
- First public release