yarn react-hook-form 7.87.0
Version 7.87.0

4 hours ago

✨ 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! 🎉

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

NewReleases is sending notifications on new releases.