Skip to content

Releases: react-hook-form/react-hook-form

Version 7.39.6

27 Nov 02:00
Compare
Choose a tag to compare

馃殌 fix fieldArray changes only notify relevant subscribers (#9448)
馃 improve useFormContext perf by avoid reference re-create with omit ( #9407)
馃拞馃徎 fix potential watch() global state overwrite (#9450)
馃 close #9410 improve UX when subscribe to both isValid and errors state (#9413)
馃エ added eslint rule for no-extra-boolean-cast (#9449)

thanks to @elton-okawa

Version 7.40.0-next.1

23 Nov 21:38
Compare
Choose a tag to compare
Version 7.40.0-next.1 Pre-release
Pre-release

馃憤 Improved async defaultValues inference

const fetchData = async () => {
  await sleep(1000)
  return {
    data: 'test'
  }
}

- useForm<Awaited<ReturnTypeof<typeof fetchData>>>({
+ useForm({
  defaultValues: fetchData, // will infer the promise return type
})

馃憤 Improved useForm resetOptions to keep track of dirty input

- const { formState: { dirtyFields } } = useForm({
+ useForm({ // dirtyFields subscription is no longer required
  values,
  resetOptions: {
    keepDirtyValues; true, // only non dirty input will receive data from the values update
  }
})

馃 improve useFormContext perf by avoiding reference re-create with omit
馃 close #9410 improve UX when subscribing to both isValid and errors state (#9413)

Version 7.39.5

21 Nov 04:21
Compare
Choose a tag to compare

馃崉 upgrade to TS4.9 (#9371)
馃悶 fix #9383 always updates the errors state for the field array even when the errors subscription missing (#9384)
馃尰 close #9379 flush extra re-render to update the current form state subscription
馃ソ improve watch logic (#9397)
馃敤 fix conditional useFormState test (#9388)

thanks to @romain-trotard

Version 7.40.0-next.0

17 Nov 00:07
Compare
Choose a tag to compare
Version 7.40.0-next.0 Pre-release
Pre-release

馃憠 NEW values props

The following syntax will react to values prop update/changes.

  • values will be reactive to update/change and reset accordingly
  • provide a reset option to keep dirty/touched values potentially
const values = await fetch('API')

useForm({
  values, // will reset the form when values updates
  // resetOptions: {
  //   keepDirtyValues: true
  // }
})

馃憠 NEW async defaultValues props

The following syntax will support async defaultValues, so we will manage the reset form internally and update formState accordingly.

  • promise will only be resolved once during useForm() call
  • It's possible to supply resetOptions as well
useForm({
  defaultValues: fetch('API')
  // resetOptions: {
  //   keepDirtyValues: true
  // }
})

React use API

useForm({
  defaultValues: use(fetch('API'))
  // resetOptions: {
  //   keepDirtyValues: true
  // }
})

馃檵 What's the difference between values and defaultValues

values will react to changes and reflect on the form values, and defaultValues is cached for once and will never re-run the promise or react to defaultValues changes.

馃尰 close #9379 flush extra re-render at useFormState to update current form state subscription (#9380)
馃崉 upgrade to TS4.9 (#9371)

Version 7.39.4

14 Nov 22:48
Compare
Choose a tag to compare

馃悶 fix #9366 useWatch with shadow clone Set data (#9369)
馃悶 fix #9365 native validation error persists (#9370)

Version 7.39.3

10 Nov 23:53
Compare
Choose a tag to compare

馃う fix #9355 by revert "馃ジ related #9310 regression to include actual ref instead custom object ( #9312)"

Version 7.39.2

09 Nov 23:09
Compare
Choose a tag to compare

鈱笍 close #9339 objects of validation rules type (#9341)
馃ジ related #9310 regression to include actual ref instead custom object ( #9312)

Version 7.39.1

02 Nov 10:50
Compare
Choose a tag to compare

Revert "馃く use input reference instead custom object (#9132)" (#9311)

Version 7.39.0

01 Nov 22:32
Compare
Choose a tag to compare

馃敭 improve #8601 and remove the relationship between isValid state with mode (#9219)

Screen.Recording.2022-11-02.at.9.47.35.am.mov

馃悶 fix #9282 regression on async validation block validation (#9286)
馃悶 fix #9251 isValidating state stale with resolver (#9254)
馃弽 delete dirty fields node instead of marking as false (#9156)
馃く use input reference instead custom object (#9132)
馃 improve native reset API invoke (#9293)
馃 related #9290 improve setCustomValidity logic (#9292)
馃懞 fix re-render bug with isValid (#9307)

Version 7.38.0

18 Oct 21:23
Compare
Choose a tag to compare

馃暟 support validation for week and time input type (#9189)

<input
  {...register("week", { min: "2022-W40", max: "2022-W50" })}
  type="week"
/>
<input
  {...register("time", { min: "11:00", max: "12:00" })}
  type="time"
/>
Screen.Recording.2022-10-19.at.8.21.56.am.mov

馃馃徎 enable focus error with disabled inputs while submitting (#9155)
馃П prevent runtime error startsWith called with undefined (#9223)
馃悶 fix #9216 isValid state not update with async form level trigger (#9218)
馃Е fix accessibility issue on examples with input missing id (#9174)
馃殧 check field array value type before updating (#9170)
馃摀 update TSDoc for useFieldArray (#9178)

thanks to @BogdanCerovac and @leapful