๐Ÿš€ react-hook-form/react-hook-form - Release Notes

Version 7.55.0 (2025-03-28)

โšก๏ธ `createFormControl`

- Allow us to start subscribing outside of the React component

```tsx
const { formControl, control } = createFormControl(props)

function App() {
  const { register } = useForm({
    formControl,
  })

  return 
} function Test() { useFormState({ control // no longer need context api }) } ``` โšก๏ธ `subscribe` - subscribe form state update without re-render - subscribe outside of the react component ```tsx const { formControl } = createFormControl(props) formControl.subscribe({ formState: { isDirty: true }, callback: (formState) => { if (formState.isDirty) { // do something here } } }) function App() { const { register } = useForm({ formControl, }) return } ``` ๐Ÿชฒ fix https://github.com/react-hook-form/react-hook-form/issues/12680: Update Fieldarray Unmount Status (https://github.com/react-hook-form/react-hook-form/pull/12690) ๐Ÿซก fix: improve type inference for useFormContext (https://github.com/react-hook-form/react-hook-form/pull/12689) ๐Ÿ‘ฎโ€โ™‚๏ธ feat: infer resolver output types (https://github.com/react-hook-form/react-hook-form/pull/12638) ๐Ÿž fix(useForm): make values and defaultValues work correctly with createFormControl and useMemo (https://github.com/react-hook-form/react-hook-form/pull/12675) ๐Ÿฅน close https://github.com/react-hook-form/react-hook-form/issues/12665 issue with values not populate form ๐Ÿž fix https://github.com/react-hook-form/react-hook-form/issues/12665 regression on values over take default values ๐Ÿซก allow use of handleSubmit with native events (https://github.com/react-hook-form/react-hook-form/pull/12645) ๐Ÿž fix https://github.com/react-hook-form/react-hook-form/issues/12631 revalidateMode issue with useFieldArray validation (https://github.com/react-hook-form/react-hook-form/pull/12646) ๐Ÿฆฅ close https://github.com/react-hook-form/react-hook-form/issues/12634 allow components with useController hook be memoized (https://github.com/react-hook-form/react-hook-form/pull/12635) ๐Ÿž fix https://github.com/react-hook-form/react-hook-form/issues/12580 setError in useEffect does not work when used inside the FormProvider context (https://github.com/react-hook-form/react-hook-form/pull/12642) ๐Ÿ›Ÿ fix: add the condition to prevent infinite render with errors prop (https://github.com/react-hook-form/react-hook-form/pull/12622) ๐Ÿž fix https://github.com/react-hook-form/react-hook-form/issues/12580 valid state update with onBlur mode (https://github.com/react-hook-form/react-hook-form/pull/12612) ๐Ÿž fix https://github.com/react-hook-form/react-hook-form/issues/12572 disabled field value not get undefined in resolver (https://github.com/react-hook-form/react-hook-form/pull/12573) ๐Ÿฆพ feat: reference stable for useWatch defaultValue (https://github.com/react-hook-form/react-hook-form/pull/12564) โฐ chore: remove typetest folder from build (https://github.com/react-hook-form/react-hook-form/pull/12555) ๐Ÿž fix https://github.com/react-hook-form/react-hook-form/issues/12532 useController should unregister issue with strict mode (https://github.com/react-hook-form/react-hook-form/pull/12538) ๐Ÿ‘๏ธ feat: improve reference update with useWatch (https://github.com/react-hook-form/react-hook-form/pull/12537) ๐Ÿฆฅ close https://github.com/react-hook-form/react-hook-form/issues/12531 disabled state issue with touched and dirty (https://github.com/react-hook-form/react-hook-form/pull/12536) thanks to @jtomaszewski, @joshkel, @candymask0712, @kotarella1110, @jorisre, @jtomaszewski, @controversial and @jedahu

Version 7.55.0-next.9 (2025-03-17)

๐Ÿชฒ fix #12680: Update Fieldarray Unmount Status (#12690)
๐Ÿซก fix: improve type inference for useFormContext (#12689)

thanks to @jorisre & @DavidIMk 

Version 7.55.0-next.8 (2025-03-13)

๐Ÿ‘ฎโ€โ™‚๏ธ feat: infer resolver output types (#12638)
๐Ÿž fix(useForm): make values and defaultValues work correctly with createFormControl and useMemo (#12675)
๐Ÿฅน close #12665 issue with values not populate form

thanks @kotarella1110, @jorisre, @jtomaszewski, @controversial and @jedahu

Version 7.55.0-next.7 (2025-03-07)

๐Ÿž fix #12665 regression on values over take default values

Version 7.55.0-next.6 (2025-03-05)

๐Ÿซก allow use of handleSubmit with native events (#12645)
๐Ÿž fix #12631 revalidateMode issue with useFieldArray validation (#12646)
๐Ÿฆฅ close #12634 allow components with `useController` hook be memoized (#12635)
๐Ÿž fix #12580 `setError` in `useEffect` does not work when used inside the FormProvider context (#12642)

thanks to @jtomaszewski, @joshkel, @candymask0712 & @kotarella1110 

Version 7.55.0-next.5 (2025-02-22)

๐Ÿ›Ÿ fix: add the condition to prevent infinite render with `errors` prop (#12622)
๐Ÿž fix #12580 valid state update with `onBlur` mode (#12612)

Version 7.55.0-next.4 (2025-02-08)

๐Ÿž fix #12572 disabled field value not get undefined in resolver (#12573)
๐Ÿฆพ feat: reference stable for useWatch defaultValue (#12564)
โฐ chore: remove __typetest__ folder from build (#12555)

Version 7.55.0-next.3 (2025-01-25)

๐Ÿž fix #12532 `useController` should unregister issue with strict mode (#12538)
๐Ÿ‘๏ธ feat: improve reference update with `useWatch` (#12537)

Version 7.55.0-next.2 (2025-01-18)

๐Ÿฆฅ close #12531 disabled state issue with touched and dirty (#12536)

Version 7.55.0-next.1 (2024-12-27)

๐Ÿฅฒ fix incorrect type for `useForm` with `formControl`

```diff
const { formControl, control } = createFormControl(props)

function App() {
  const { register } = useForm({
-    control,
+    formControl,
  })

  return 
}
```

๐ŸŽ„ Version7.55.0-next.0 (2024-12-24)

โšก๏ธ `createFormControl`

- Allow us to start subscribing outside of the react component

```tsx
const { formControl, control } = createFormControl(props)

function App() {
  const { register } = useForm({
    formControl,
  })

  return 
}

function Test() {
  useFormState({
    control // no longer need context api
  })
}
```

โšก๏ธ `subscribe`

- subscribe form state update without re-render
- subscribe outside of the react component

```tsx
const { formControl } = createFormControl(props)

formControl.subscribe({
  formState: { isDirty: true },
  callback: (formState) => {
    if (formState.isDirty) {
      // do something here
    }
  }
})

function App() {
  const { register } = useForm({
    formControl,
  })

  return 
}
```

Version 7.54.2 (2024-12-20)

โš›๏ธ fix #12478 issue should unregister input with controller (#12480)
โฐ close #12443 track disabled fields and only omit data on submit (#12491)
โš›๏ธ upgrade e2e automation app to react 19 (#12482)
๐Ÿงช test(useWatch): destructure setValue from useForm

Thanks very much, @marcalexiei for your contribution to the documentation!  

Version 7.54.1 (2024-12-12)

Revert "๐Ÿฆฅ fix: useForm should return a new object on formState changes (#12424)" (#12475)

Version 7.54.0 (2024-12-06)

๐Ÿฆฅ fix: useForm should return a new object on formState changes (#12424)
๐Ÿงป improve prototype pollution check (#12431)
๐Ÿช– fix: add FileList availability check for environments without FileList support (#12332)
๐Ÿงช close #12198 memo for useController and useFormState (#12421)
๐Ÿž fix #12407 useFieldArray append issue with useForm disabled props (#12420)
๐Ÿž fix #12415 issue with flatten object with null value (#12418)
๐Ÿž fix #12385 nested array field invalid validation report on removed (#12405)
๐Ÿ™€ fix: hasPromiseValidation return true or false appropriately. (#12389)
๐Ÿ‘ƒ fix more staled props (#12404)

thanks to @developer-bandi, @OlegDev1, @sukvvon, @alexandredev3 and @mfazekas

Version 7.53.2 (2024-11-08)

๐Ÿž fix #12398 staled disabled issue with resubmit form (#12403)
๐Ÿž fix: add type guard to fieldRef.select (#12390)
Revert "๐Ÿบ watch reference update on formState update (#12326)" (#12391)

thanks to @developer-bandi

Version 7.53.1 (2024-10-19)

๐Ÿž fix: #12294 ensure Invalid Date is evaluated correctly (#12295)
๐Ÿž fix #12316 setValue should work for arrays of primitives to handle checkboxes (#12316) (#12317)
๐Ÿž fix #12097 Use dirty fields along with mount names for form reset with keepDirtyValues (#12211)
๐Ÿซ€ fix #12237 disabled state trigger formState dirty/dirtyFields to update (#12239)
๐Ÿž fix #12291 field array remove cause undefined with FormData (#12305)
๐Ÿ“ improve flatten function with object type check (#12306)
๐Ÿ–๏ธ improve: resolve type of set function (#12145)
๐Ÿ”ง chore: upgrade eslint to v9 (#12150)
๐Ÿ“– fix: code example input field placeholder name (#12296)
๐Ÿ“– docs: fix typo in code example (#12271)

thanks to @rasikhq @abnud11 @crypt0box @developer-bandi @matmannion @hasancruk & @vismay7

Version 7.53.0 (2024-08-24)

๐ŸŒซ๏ธ feat: #12148 support isValid when mode is set to onBlur (#12194)

```tsx
// update formstate isValid with onBlur event
const { formState: { isValid } } = useForm({
  mode: 'onBlur'
})
```

๐Ÿž fix #12021 issue with disable prop not reflecting on re-render without trigger by useEffect (#12193)
๐Ÿ‘ฉโ€๐ŸŒพ close #12168 optimise re-render with validating fields subscription (#12192)
๐Ÿž fix #12127 issue with compare object value changed with object input (#12185)
๐ŸŽฒ improve : break out of recursive loops on first focus (#11827)
๐Ÿ“– fix example of ObjectKeys type (#11965)

thanks to @suke & @DPflasterer

Version 7.52.2 (2024-08-03)

๐Ÿ‘ close #12108 useController should subscribe to exact field name of form's state (#12109)
๐Ÿ‘ chore: upgrade app deps
๐Ÿฉป fix: add useCallback for ref callback (#12078)
๐Ÿš€ fix: skip call executeBuiltInValidation if no sub-fields left (#12054)

thanks to @newsiberian, @Wendystraite and @abnud11

Version 7.52.1 (2024-07-02)

๐Ÿž fix #12024 dirty not update issue with values prop (#12041)
๐Ÿž fix: field array validate rules shift errors (#12033)

thanks to @JardelCheung

Version 7.52.0 (2024-06-15)

โš›๏ธ close #11932 enable react 19 peer dependency (#11935)
๐Ÿ‘ฎโ€โ™€๏ธ close #11954 getFieldState remove unnessaried inValidating and touched subscription (#11995)
๐Ÿž fix #11985 logic createFormControl check field before usage (#11986)
โŒจ๏ธ fix: enforce type safety for deps property in RegisterOptions (#11969)
๐Ÿž fix #11922 keep dirty on reset with dirty fields (#11958)
๐Ÿš” close #11937 add validation in the cleanup process in useController (#11938)
Revert "โŒจ๏ธ close: correct type of error field in getFieldState return object (#11831)"
๐Ÿ“– fix: change info.values type in WatchObserver (#11917)

thanks to @nakaakist, @IdoBouskila, @pincy and @peinguin 

Version 7.51.5 (2024-05-21)

๐Ÿ“– fix broken link to examples in README.md (#11805)
โŒจ๏ธ close: correct type of error field in getFieldState return object (#11831)
๐Ÿž fix #11842 radio buttons not disabled when multiple share a name (#11873)
๐Ÿž fix #11821 set value with disabled false before mount (#11880)
๐Ÿž fix setError to preserve existing errors elsewhere in the object (#11888)
โŒจ๏ธ fix: add info.value type to WatchObserver (#11872)
๐Ÿซก fix issue with internal `set` api (#11915)

thanks to @mjr2595 @erashu212 @SimonJTurner and @peinguin 

Version 7.51.4 (2024-05-04)

๐Ÿ‘น close #11778 improve unregister omit key with getValues method (#11779)
๐Ÿž fix #11794  issue: Fields dirty state is not updated when passing values to useForm

Version 7.51.3 (2024-04-11)

๐Ÿž fix #11773 regression on dirty check with reset (#11775)

Version 7.51.2 (2024-03-26)

๐Ÿž fix #11719 validation stuck on true state (#11723)

Version 7.51.1 (2024-03-17)

๐Ÿ› bug(validatingFields, trigger): handle all fields validation trigger (#11624)
๐Ÿ’š ci: cleanup actions versions (#11629)
๐Ÿž fix #11590 issue with trigger on validatingFields (#11613)

thanks to @Moshyfawn 

Version 7.51.0 (2024-03-01)

๐Ÿ’ฌ add `isValidating` and `validatingFields` to field state (#10657)

```tsx
const { formState: { validatingFields } } = useForm({ mode: 'onBlur' });
```

โŒจ๏ธ chore: replace ts-ignore with ts-expect-error (#11573)
๐Ÿง—โ€โ™‚๏ธ chore: update lib dev deps (#11548)
๐Ÿ’… related #11541 improve dirty check when undefined provided with reset api
๐Ÿ˜พ fix #11514 issue under strict mode reset invoke twice reset mounted field names with keepDirtyValues (#11546)
๐Ÿคก fix flush root render hack (#11521)
๐Ÿงฝ chore: removed unused utils and resp. test cases (#11476)
๐Ÿž close #11503 issue dirty field update with async validation (#11509)

Revert "๐Ÿ”ง fix data param in handleSubmit when TTransformedValues is a union type (#11420)"
Revert "โœจ feat(values): priorities values over defaultvalues (#11399)" (#11545)

โค๏ธ Thanks to @deepgolani4, @pbankonier and @deepgolani4
โค๏ธ Thank you principal.com for your contribution

Version v7.50.1 (2024-02-06)

๐Ÿฅฒ Regression: Revert "โŒจ๏ธ fix #10734 watch and useWatch without parameters return type (#11359)"

Versions 7.50.0 (2024-02-01)

๐Ÿ”ง fix data param in handleSubmit when TTransformedValues is a union type (#11420)
๐Ÿ‘ท build(Engines): remove pnpm dependency (#11425)
๐Ÿž fixes #11386 get new dirtyFields when reset keeping defaults and dirty values (#11401)
๐Ÿท๏ธ improve CustomElement type (#11309)
๐Ÿ’ซ feat(useForm): leave formState flags in a consistent state when throwing in handleSubmit onValid (#11214)
โŒจ๏ธ fix: change DeepPartial to account for object union types & unknown (#11385)
โœจ feat(values): priorities values over defaultvalues (#11399)
๐Ÿž close #11246 skip root validation on action when mode and revalidate mode is onSubmit (#11395)
๐Ÿ’ฉ fix #11322 trigger extra re-render with useWatch plus shouldUnregister (#11394)
โŒจ๏ธ fix #10734 watch and useWatch without parameters return type (#11359)
๐Ÿง‘โ€โœˆ๏ธ fix #11281 issue with upgrade node version (#11392)
๐Ÿž fix #11368 keep form state mounted when keeping values (#11384)
๐Ÿž fix #11374: Nested deep partial with unknown (#11373)

thanks to @Moshyfawn, @jonahallibone, @eladattias1996, @RulerOfCakes, @anonkey, @Ar4ys, @IanVS and @r-kataoka11

Version 7.49.3 (2024-01-08)

๐Ÿ› fix(formState, disabled): infer controlled disabled form state (#11361)
๐Ÿ› fix(reset): remove global reset option flag (#11355)
๐Ÿ› fix(useController): check if disabled state was set by user (#11353)
๐Ÿ–จ๏ธ fix: Change DeepPartial type definition to be compatible with unknown (#11333)
๐Ÿž fix #11328 resetField with object as defaultValue (#11329)

thanks to @Moshyfawn, @geeee and @RulerOfCakes

Version 7.49.2 (2023-12-13)

๐Ÿž fix #11292 issue with controller validation prop (#11294)