docs: document exact ancestor-path matching since 7.81.0 - #1231
Merged
bluebill1049 merged 1 commit intoAug 29, 2026
Conversation
Since react-hook-form 7.81.0 (react-hook-form/react-hook-form#13553), subscriptions with `exact: true` also fire when an ancestor path of the subscribed name is updated. Changes to nested child paths still do not notify with `exact: true`. Update the `exact` row in the useWatch, useFormState, useController, Controller, Watch, FormState and subscribe props tables accordingly, and show subscribe's default (`boolean = false`).
Contributor
|
@22mb is attempting to deploy a commit to the BEEKAI OSS Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for sage-cassata-31d224 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since v7.81.0, a subscription with
exact: truealso fires when an ancestor path of the subscribed name is updated. Before 7.81.0,exact: trueonly matched the identical name. The reverse direction is unchanged: withexact: true, a change to a nested child path still does not notify a subscriber of the parent name (see react-hook-form/react-hook-form#12867).The behavior changed in react-hook-form/react-hook-form#13553 (fixes react-hook-form/react-hook-form#13550, first released in v7.81.0), but neither the release notes nor the CHANGELOG mention
exact, and the docs still describeexact: trueas "an exact match for input name subscriptions". I ran into this when upgrading.Source of truth (
src/logic/shouldSubscribeByName.ts):For a subscription to
"users.0.name":exact: falseexact: true(< 7.81.0)exact: true(>= 7.81.0)"users.0.name""users.0"/"users"(ancestor)For a subscription to
"users", a change to"users.0.name"(descendant) fires only withexact: false— unchanged.Changes
Updated the
exactrow in every props table that has one, following the existing<Since version="..." />convention (as in #1206, #1216, #1219):useWatch(usewatch.mdx),useFormState(useformstate.mdx),subscribe(useform/subscribe.mdx): describe bothfalseandtrue, including the 7.81.0 ancestor-path behavior and the asymmetry.useController(usecontroller.mdx),Controller(usecontroller/controller.mdx): same, phrased for the controlled field (defaultexact: true), with a hint thatexact: falsealso receives nested updates.Watch(usewatch/watch.mdx),FormState(useformstate/formstate.mdx): short version linking to the hook docs.subscribe'sexacttype now shows its default (boolean = false), consistent with the other tables (exactis passed through as-is, so it is falsy unless set).The rest of the diff is prettier re-padding the tables;
pnpm formatpasses.