Skip to content

fix: cancel nested delayError timers on resetField parent reset - #13769

Merged
bluebill1049 merged 1 commit into
react-hook-form:masterfrom
soroush5:fix/resetfield-cancels-nested-delayed-errors
Sep 19, 2026
Merged

bluebill1049 merged 1 commit into
react-hook-form:masterfrom
soroush5:fix/resetfield-cancels-nested-delayed-errors

Conversation

@soroush5

Copy link
Copy Markdown
Contributor

resetField on a parent left nested delayError timers alive, so a stale error popped back after a per-section reset and blocked submit while isValid read true. The tree-cancel used by clear/unregister now runs here too.

Verified: new test fails before and passes after, full suite green, real Chromium both directions.

Fixes #13768

@bluebill1049
bluebill1049 merged commit 8b0ff77 into react-hook-form:master Sep 19, 2026
6 checks passed
@soroush5

Copy link
Copy Markdown
Contributor Author

Thanks for merging.

bluebill1049 added a commit that referenced this pull request Sep 20, 2026
…13771)

`executeSchemaAndUpdateState` unsets the whole subtree of each validated
name, but only cancelled that exact name's delayError timer. A timer
already scheduled for a nested field therefore survived the validation
and, when it fired, wrote its stale error back into form state — under a
subtree the resolver had just reported clean.

Use `cancelDelayedErrorTree`, as `clearErrors`, `unregister` and
`resetField` already do for the same reason (#13736, #13769).

Co-authored-by: Bill <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resetField on parent leaves nested delayError timers alive

2 participants