Repository navigation
fix: synchronize useWatch cache when compute is omitted - #13987
Merged
bluebill1049 merged 2 commits intoNov 6, 2026
Merged
bluebill1049 merged 2 commits into
bluebill1049 merged 2 commits into
Conversation
bluebill1049
approved these changes
Nov 6, 2026
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.
Proposed Changes
When
computeis omitted temporarily,useWatchpublishes raw form values but leaves its comparison cache holding the previous computed output. Aftercomputeis restored, a subsequent form update can produce that earlier output and incorrectly skip the state update, leaving the raw value visible.For example, computing
"a"as"A", omittingcomputewhile setting"b", then restoringcomputeand setting"a"leaves"b"instead of"A".Keep the comparison cache synchronized with the raw value passed to
updateValue. Add regressions throughWatchfor both a string result and a validundefinedresult. This changes no subscriptions or effect dependencies.Validation with Node 22:
pnpm test --ci --runInBand: 133 suites, 1,832 tests and 26 snapshots passed. Both new regressions fail without the source fix.pnpm type,pnpm test:type,pnpm lint, and Prettier passed.pnpm e2e --config ../rhf-playwright.config.ts --workers=1 --retries=0: all 90 tests passed. The local config selects Chromium 149 and starts the normalpnpm startserver; tests and assertions are unchanged. An initial two-worker run hit the existing asynchronous StrictMode timing case; it passed in isolation and in the complete one-worker run.pnpm build,pnpm api-extractor, andpnpm api-extractor:cipassed.Type of change
Checklist: