Skip to content

Releases

Version 7.92.0

Choose a tag to compare

@bluebill1049 bluebill1049 released this 11 Nov 10:24

🐞 Fixes

  • Fix useFormState and Controller unnecessarily cloning form state during mount and unmount (#13945)
  • Fix setValues not updating dirty state for unregistered fields (#13946)
  • Fix form state values becoming inconsistent (#13948)
  • Fix setValue not selecting checkbox options with empty string values (#13950)
  • Fix stale asynchronous form-level validation results (#13951, #13954)
  • Fix useFieldArray applying reValidateMode: 'onSubmit' before submission (#13952)
  • Fix default values not being applied correctly to selects with disabled optgroups (#13953)
  • Fix useController reading stale shouldUnregister options (#13956, #13996)
  • Fix focusing disabled radio and checkbox inputs (#13960, #13968, #13977)
  • Fix TypeScript type regression (#13963)
  • Fix field array notifications using stale values (#13965)
  • Fix rejected submission callbacks with falsy rejection reasons (#13967)
  • Fix useWatch missing reset() updates on mount in React Native (#13974)
  • Fix trigger losing nested field array root errors (#13975)
  • Fix unregister retaining descendant registrations when removing a parent (#13976)
  • Fix trigger not marking nested fields as touched when shouldTouch targets a parent (#13978)
  • Fix useWatch compute cache not synchronizing when compute is removed (#13987)
  • Fix setValues ignoring options when values remain unchanged (#13989)
  • Fix handleSubmit incorrectly updating form state after reset() during asynchronous callbacks (#13991)
  • Fix useFieldArray retaining validation rules after the rules prop is removed (#13992)
  • Fix reset not updating isValid after cancelling pending validation (#13994)
  • Fix TypeScript nested array paths not preserving undefined (#13995)
  • Fix <Form /> not respecting encType when constructing request bodies (#13997)
  • Fix handleSubmit not supporting nullish and primitive transformed values with disabled fields (#13999, #14011)
  • Fix useController dirty tracking with controller-level defaultValue (#14001)
  • Fix multi-select changes including disabled options (#14002)
  • Fix register overwriting untouched range and color input defaults (#14007)
  • Fix stale schema resolver errors after field array operations (#14008)
  • Fix unset failing on primitive values (#14014)
  • Fix form-level validation errors appearing before submission during isValid checks (#14015)
  • Fix stale field errors when form-level validation returns a message (#14016)
  • Fix repeated reset() calls and error focusing with keepFieldsRef and memoized inputs (#14023)

⚡ Performance Improvements

  • Avoid unnecessary form state cloning in useFormState and Controller (#13945)

🧹 Refactors

  • Skip non-dirty array holes when collecting dirty field names (#13979)
  • Avoid mutating field metadata when building resolver options (#13984)

🧪 Tests

  • Expand regression coverage for reset, useController, useFieldArray, validation, dirty state and form submissions
  • Add regression coverage for disabled radio and checkbox inputs, React Native reset handling, and primitive transformed values

📦 Dependencies

  • Bump fast-uri from 3.1.8 to 3.1.9 (#13949)
  • Bump follow-redirects from 1.16.1 to 1.16.2 (#13985)
  • Bump vite from 6.4.4 to 6.4.5 (#13983)
  • Bump joi from 18.2.9 to 18.3.1 (#13986)

❤️ Thank You

Thanks to @charan-rathore, @clean99, @KooYS, @dfedoryshchev, @maxymlyskov, @aumilkyeong, @hamarshehmhmd, @zigzagdev, @wozhenbang2004, @Aminark, @zendesk-robryan, @MomenSherif, @Shellghostt, @SatyamGangani, @yxshee, @timsnadden and @bluebill1049 for their contributions! 🎉

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

Version 8.0.0-beta.5

Version 8.0.0-beta.5 Pre-release
Pre-release

Choose a tag to compare

@bluebill1049 bluebill1049 released this 23 Oct 21:42

✨ 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 [email protected]

Version 7.91.0

Choose a tag to compare

@bluebill1049 bluebill1049 released this 23 Oct 21:19

🐞 Fixes

  • Fix useFieldArray not updating rows when using setValue or setValues (#13842, #13939)
  • Fix useFieldArray not unregistering values correctly 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 dirty state updates when setValues changes field arrays (#13870)
  • 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 form state subscriptions and validity updates (#13866, #13877, #13906)
  • 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 progressive required attributes (#13924)
  • Fix numeric zero maxLength validation (#13851)
  • Fix object comparison for null-prototype objects and sparse arrays (#13853, #13855, #13857)
  • Fix cloneObject handling objects with a constructor key (#13875)
  • Fix setValue handling null-prototype objects (#13916)
  • Fix form-level validation error types (#13860)
  • Fix useForm mutating the externally provided errors object (#13896)
  • Fix stale NaN and invalid date validation results (#13910)

⚡ Performance Improvements

  • Avoid unnecessary copies when calling getValues() (#13894)
  • Reduce unnecessary <Form /> re-renders (#13899)

🧹 Refactors

  • Simplify multipart Content-Type handling (#13926)
  • Improve internal types and remove unnecessary type assertions (#13871, #13886)
  • Clean up memoized component display names (#13897)
  • Fix JSDoc examples (#13895)

🧪 Tests

  • Add coverage for disabled field array operations (#13841)
  • Expand regression coverage for useFieldArray, reset, validation and form state

📦 Dependencies

  • Bump joi from 18.2.6 to 18.2.9 (#13836)
  • Update browserslist and baseline-browser-mapping (#13837, #13838, #13839)
  • Bump follow-redirects from 1.16.0 to 1.16.1 (#13913)
  • Bump vite from 6.4.3 to 6.4.4 (#13914)

❤️ Thank You

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

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

Version 7.90.0

Choose a tag to compare

@bluebill1049 bluebill1049 released this 10 Oct 02:45
8ac7cc0

🐞 Fixes

  • Fix useForm marking fields named after Object.prototype members as touched on blur and setValue (#13833)
  • Fix cloneObject preserving the length of sparse arrays (#13834)
  • Fix dirty values extraction for fields named hasOwnProperty (#13832)
  • Fix useForm retaining options removed from props on re-render (#13831)
  • Fix useFieldArray handling duplicate indexes in remove() without mutating the provided indexes (#13830)
  • Fix useFieldArray unregistering fields while a parent array reindexes (#13828)
  • Fix input values edited before the form is ready being lost (#13827)
  • Fix useWatch not updating watched objects after an Activity subtree reconnects (#13819)
  • Fix reset() incorrectly setting isDirty when using keepDefaultValues without values (#13820)
  • Fix Controller blur validation not working after reset() (#13817)
  • Fix watch using stale shouldUnregister options when registering fields (#13814)
  • Fix form value comparison for fields named ref (#13812)
  • Fix native validation using stale shouldUseNativeValidation options (#13806)
  • Fix cloneObject not cloning objects with a null prototype (#13808)
  • Fix useWatch array names not prioritizing form defaultValues (#13805)
  • Fix error updates not producing a new errors reference (#13800)
  • Fix setError and clearErrors not producing a new errors reference (#13791)

⚡ Performance Improvements

  • Improve dirty fields checking (#13788)
  • Improve subscription value handling (#13787)
  • Improve watch API performance (#13792)
  • Improve named scoped subscriptions (#13793)
  • Preserve form-state tracking across unsubscribe (#13794)
  • Improve subject subscription handling (#13795)
  • Skip redundant form-state merges during subscriber notifications (#13796)
  • Avoid allocations when matching subscription names (#13823)

🧹 Refactors

🧪 Tests

  • Add coverage for useFieldArray index boundary and no-op behavior (#13815, #13822, #13824, #13829)
  • Add coverage for JSON stringify and parse edge cases (#13821)

📦 Dependencies

  • Bump fast-uri from 3.1.2 to 3.1.8 (#13811)
  • Bump joi from 18.2.5 to 18.2.6 (#13810)

❤️ Thank You

Thanks to @charan-rathore, @zigzagdev, @AdzerKI, @huytdps13400, @dfedoryshchev, @kory-kaai, @Mohamed-Elshesheny, @breken-ai, @sarmah-rup, @00200200, @giaBaoJS and @bluebill1049 for their contributions! 🎉

Version 8.0.0-beta.4

Version 8.0.0-beta.4 Pre-release
Pre-release

Choose a tag to compare

@bluebill1049 bluebill1049 released this 26 Sep 00:50

🦾 Syncs v8 beta with the latest master branch, bringing over recent v7 bug fixes, performance improvements, refactors, and DX updates.

Version 7.89.0

Choose a tag to compare

@bluebill1049 bluebill1049 released this 26 Sep 00:46
4722d22

🐞 Fixes

  • Fix form state select option (#13784)
  • Remove duplicate default value field (#13783)
  • Fix validateField skipping refs without setCustomValidity under native validation (#13782)
  • Fix form-level validation using a stale validate function (#13777)
  • Fix useFieldArray touched fields handling (#13776)
  • Fix pending delayError timers for nested paths (#13775)
  • Fix getValues extracting unmarked field array entries (#13773)
  • Fix field array touched state not being re-indexed when unsubscribed (#13772)
  • Fix nested delayError timers remaining when a parent validates clean (#13771)
  • Fix nested delayError timers remaining after resetField() resets a parent (#13769)
  • Fix stale field array root errors after an operation satisfies the validation rule (#13767)
  • Fix setValue() not revalidating dependencies when shouldValidate is enabled (#13765)
  • Fix stale built-in validation results after reset() during handleSubmit() (#13761)
  • Fix stale form-level validation results after reset() (#13762)
  • Fix validation rules removed from register options at runtime remaining active (#13758)
  • Fix useController required validation not using the controlled value (#13756)
  • Fix stale form-level errors remaining after successful re-validation (#13755)
  • Fix useFieldArray marking the form dirty when the array default value is null (#13750)
  • Fix isValid not being recomputed when the errors prop is emptied (#13748)
  • Fix form-level validation running more than once per traversal (#13747)
  • Fix stale built-in validation results after reset() during onChange (#13745)
  • Fix stale resolver results after reset() during onChange (#13744)
  • Fix setValue() not triggering field array root validation when shouldValidate is enabled (#13743)
  • Fix getFieldState(name, formState) updates after reset() (#13741)
  • Fix dirty state remaining for rows removed from a field array (#13739)

🧹 Refactors

  • Replace rimraf cleanup with fs.rmSync (#13770)
  • Reduce bundle size (#13759)

📦 Dependencies

  • Add optional @types/react peer dependency (#13781)

❤️ Thank You

Version 7.88.0

Choose a tag to compare

@bluebill1049 bluebill1049 released this 11 Sep 22:30

✨ Features

  • Add Error Message component (#13472)
  • Add the Error Message component for displaying validation errors from React Hook Form.

🐞 Fixes

  • Fix stale validating state after resetField() (#13735)
  • Fix errors and touched state remaining for rows removed by replace() (#13734)
  • Fix stale resolver results updating form state after reset() during handleSubmit() (#13733)
  • Fix nested registered errors being removed when trigger() targets their parent (#13732)
  • Fix resolver-reported root errors being dropped during handleSubmit() (#13731)
  • Fix parent errors being incorrectly set when trigger() targets a field with only nested resolver errors (#13730)
  • Fix useWatch compute cache not being initialized with the initial output (#13728)
  • Fix FileList being lost during flatten/expand and omit undefined values in jsonToFormData (#13725)
  • Fix schemaErrorLookup reporting nested containers as exact-name errors (#13727)
  • Fix isValidating not being recomputed after unregister() clears validating fields (#13723)
  • Fix stale resolver state updates after reset() (#13722)
  • Fix iterateFieldsByAction only breaking out of one loop level (#13718)
  • Fix stale validation types surviving setError() overwrites (#13716)
  • Fix reset() not clearing validating fields (#13714)
  • Fix remove() leaking deleted values onto surviving field-array items (#13713)
  • Fix the React Server build being unpublished (#13709)
  • Fix validateField calling setCustomValidity once per key in validate-object mode (#13707)
  • Fix useFieldArray focus behavior for checkboxes and radio buttons in appended rows (#13705)
  • Fix getFieldState reading isValidating from the supplied form state (#13704)
  • Fix unregister() stripping kept values from the submit payload (#13703)
  • Fix useFormState not re-subscribing when control changes (#13702)
  • Fix reset() keeping dirtyFields out of sync with isDirty when keepValues is enabled (#13701)
  • Fix useForm not reconciling correctly when an Activity subtree is initially hidden (#13698)
  • Fix cleared errors returning after the delayError timer fires (#13697)
  • Fix cloneObject throwing when checking Blob with instanceof (#13694)
  • Fix useFieldArray retaining stale fields after an Activity subtree reconnects (#13688)

🧹 Refactors

  • Extend _isTracked to the remaining multi-key proxy/subscribe form-state checks (#13699)
  • Extract _isTracked helper for proxy/subscribe form-state checks (#13690)
  • Remove the unused abortEarly parameter from iterateFieldsByAction (#13689)
  • Remove redundant optional chaining from clearErrors (#13696)

📝 Documentation

  • Fix useWatch compute example variable names in JSDoc (#13700)

📦 Dependencies

  • Bump joi from 18.2.1 to 18.2.5 (#13719)

❤️ Thank You

Version 7.87.0

Choose a tag to compare

@bluebill1049 bluebill1049 released this 30 Aug 02:41

✨ Features

  • Add shouldTouch option to trigger() ([#13671](#13671))

    setValue already supported shouldTouch; trigger() now does too. This allows you to mark field(s) as touched after manual or programmatic validation, such as validate-on-mount or multi-step form navigation, without needing a setValue workaround:

    // Mark a single field as touched after validating it
    await trigger('firstName', { shouldTouch: true });
    
    // Mark every mounted field as touched after validating the whole form
    await trigger(undefined, { shouldTouch: true });
  • Add OpaqueTypes registry for opaque leaf types ([#13676](#13676))

    Recursive type helpers (Path, DeepPartial, DeepRequired, FieldErrorsImpl, etc.) previously stopped only at Primitive | BrowserNativeObject. As a result, rich third-party value types such as Dayjs and Decimal could be recursively traversed member-by-member, potentially causing TypeScript to report "Excessive complexity" diagnostics on large form types.

    You can now register a type as an opaque leaf via declaration merging:

    import type { Dayjs } from 'dayjs';
    
    declare module 'react-hook-form' {
      interface OpaqueTypes {
        dayjs: Dayjs;
      }
    }

    While the registry is empty, types remain identical to the existing behavior. This is purely opt-in.

🐞 Fixes

  • Fix inconsistent behavior among useController().field.onChange()-like APIs. ([#13673](#13673))
  • Fix Controller under a null parent submitting undefined instead of a value. ([#13675](#13675))
  • Fix ERR_MODULE_NOT_FOUND when resolving react-hook-form due to a react-server declaration in Next.js builds. ([#13682](#13682))
  • Fix useWatch never reconciling when an Activity subtree is hidden on its first render. ([#13683](#13683))
  • Fix resetField not recomputing isValid for subscribe-only consumers. ([#13684](#13684))
  • Fix generateWatchOutput ignoring defaultValue for an array of names. ([#13686](#13686))
  • Fix useFormState never reconciling when an Activity subtree is hidden on its first render. ([#13687](#13687))

❤️ Thank You

Thanks to @giaBaoJS, @dfedoryshchev, @Alioth-91, @Masatoshi0227, @modosc, and @bluebill1049 for their contributions! 🎉

Version 7.86.0

Choose a tag to compare

@bluebill1049 bluebill1049 released this 21 Aug 22:51

✨ Features

🐞 Fixes

  • Fix useWatch returning stale values when the watched name changes to null. (#13668)
  • Fix unregister keepDirty behavior. (#13669)
  • Fix setValues for fields registered under object or array values. (#13667)
  • Fix Controller notifications for field array item roots. (#13665)
  • Fix validation state checks. (#13661)
  • Fix setCustomValidity with criteriaMode: 'all'. (#13655)
  • Fix File, Blob, and FileList handling in flatten. (#13652)
  • Fix stale errors and touched state after updating a field array item. (#13650)
  • Fix stale field names leaking into persisted formState. (#13649)

🚀 Performance

  • Improve createFormControl performance. (#13648)
  • Improve cloneObject performance.
  • Avoid unnecessary value cloning in unregister. (#13662)
  • Improve performance in onChange-heavy workloads.

🧹 Chores & Refactoring

  • Remove unnecessary any usage. (#13660)
  • Improve TypeScript handling around checkbox values. (#13659)
  • Improve UUID generation. (#13658)
  • Clean up repository structure and APIs. (#13657)
  • Remove unreachable revalidation logic in useFieldArray. (#13654)

Thanks to @dfedoryshchev, @zigzagdev, @official-burak, @Jaybhade, @candymask0712, and @bluebill1049 for their contributions! 🎉

Version 7.85.0

Choose a tag to compare

@bluebill1049 bluebill1049 released this 08 Aug 01:10
371432c

✨ Improvements

  • support React <Activity /> (#13633)

🐞 Fixes

  • fix min/max validation being skipped for valueAsDate fields (#13646)
  • fix field array root errors being lost during append, prepend, insert, and remove (#13645)
  • fix stale renders recreating field array paths after field array actions (#13644)
  • fix useWatch preferring form defaultValues over the hook's own defaultValue (#13635)
  • fix setValue emitting duplicate values state notifications (#13637)
  • fix TypeScript getFieldState error resolution for field paths (#13632)

🏗️ Chores

  • remove tinybench (#13647)
  • remove dead code and stale API Extractor report (#13643)

Thanks to @zigzagdev, @bluebill1049, @anshusaurav, @saulo-silva, @EduardF1, and @candymask0712 for their contributions! 🎉