npm react-hook-form 8.0.0-beta.5
Version 8.0.0-beta.5

2 hours ago

✨ Improvements

  • Sync v8 with the latest master branch, including all fixes and improvements from v7.90.0 and v7.91.0
  • Improve React Compiler compatibility and add full test coverage with React Compiler (#13864)
  • Improve useFieldArray support for flat and primitive arrays (#13890, #13927, #13936)
  • Preserve null, undefined and falsy values in primitive field arrays (#13890, #13936)
  • Expose primitive field array rows with generated key and value properties (#13927)
  • Improve v8 TypeScript definitions and API consistency (#13887)

🐞 Fixes

  • Fix useFieldArray not updating rows when using setValue or setValues (#13842, #13939)
  • Fix useFieldArray unregistering values incorrectly on unmount (#13843)
  • Fix field registration without a value incorrectly adding array rows (#13846, #13849)
  • Fix useFieldArray reindexing fields incorrectly when array rules are registered (#13873)
  • Fix useFieldArray losing validation rules after reset() (#13940)
  • Fix stale field array validation results after array changes (#13888)
  • Fix useFieldArray validation after submission in onBlur mode (#13867)
  • Fix stale asynchronous validation results after reset() and unregister() (#13908, #13912, #13934)
  • Fix Controller validation using stale DOM values (#13880)
  • Fix isValid not updating correctly after reset() and subsequent changes (#13847, #13930)
  • Fix handleSubmit leaving isSubmitting active when validation throws (#13905)
  • Fix empty validation message arrays being treated as errors (#13937)
  • Fix delayed validation errors not being flushed on blur (#13861)
  • Fix dirty state tracking and resetField() with falsy values (#13868, #13900)
  • Fix unregister retaining validation rules when using keepValue (#13891)
  • Fix <Form /> handling of JSON, URL-encoded, multipart and plain-text submissions (#13848, #13854, #13874, #13893, #13907, #13915, #13926)
  • Fix useWatch not updating default values when the watched name changes (#13859)
  • Fix select options being lost before the form is ready (#13872)
  • Fix useForm retaining removed options and disabled state (#13882, #13883, #13889, #13898)
  • Fix object comparison for null-prototype objects and sparse arrays (#13853, #13855, #13857)
  • Fix setValue handling null-prototype objects (#13916)
  • Fix useForm mutating externally provided errors (#13896)

⚡ Performance Improvements

  • Improve getValues() performance by avoiding unnecessary copies (#13894)
  • Reduce unnecessary <Form /> re-renders (#13899)
  • Improve form state subscriptions and dirty field tracking

⚠️ Breaking Changes

  • Replace any with unknown in public types, requiring explicit typing or narrowing where appropriate
  • Rename the generated useFieldArray field identifier from id to key
  • Remove the keyName prop from useFieldArray
  • Rename the <Watch /> prop from names to name (#13879)
  • Remove the watch(callback) API; use subscribe() instead
  • Use input refs instead of partial refs (#12773)
  • Return null instead of Invalid Date for empty values with valueAsDate: true (#13901)
  • Update reference stability for selected useForm methods to support React Compiler

Migration guide: https://react-hook-form.com/migrate-v7-to-v8

🧹 Refactors

  • Improve internal TypeScript definitions and API consistency (#13871, #13886, #13887)
  • Simplify multipart Content-Type handling (#13926)
  • Remove unsupported <Watch /> properties (#13879)

🧪 Tests

  • Add React Compiler test coverage (#13864)
  • Add regression coverage for primitive field arrays, including nullish and falsy values (#13890, #13927, #13936)
  • Expand regression coverage for useFieldArray, validation, reset and form state

❤️ Thank You

Thanks to @vicuts, @maxymlyskov, @ahamsel, @dasjideepak, @feritcemkahraman, @DahanItamar, @arba-octo, @dfedoryshchev, @jeremiah-white, @TiagoGranelli, @zigzagdev, @nandyx, @hardikkaurani, @Marve10s, @candymask0712, @saaahilhussain, @itisrmk, @Enesuygurs, @kotarella1110 and @bluebill1049 for their contributions! 🎉

Special thanks to the Pennylane team for their incredible support! ❤️

📦 Installation

npm install react-hook-form@8.0.0-beta.5

Don't miss a new react-hook-form release

NewReleases is sending notifications on new releases.