Skip to content

fix(schemaErrorLookup): don't report nested containers as exact-name errors - #13727

Merged
bluebill1049 merged 1 commit into
react-hook-form:masterfrom
soroush5:fix/schema-error-lookup-exact-name
Sep 10, 2026
Merged

bluebill1049 merged 1 commit into
react-hook-form:masterfrom
soroush5:fix/schema-error-lookup-exact-name

Conversation

@soroush5

Copy link
Copy Markdown
Contributor

Fixes #13726.

Exact-name lookup returned any truthy object as the field's error, so a resolver with only nested errors (e.g. { test: { nested: {...} } }) polluted formState.errors.test with a typeless container, and exact-name root errors never resolved to test.root. Now only type/message hits (or arrays) return early; containers fall through to the existing walk.

Verified: 3 new tests fail on master and pass with the fix; full suite 1316/1316 green, tsc --noEmit and eslint clean.

…errors

Only treat the exact lookup hit as the field error when it looks like
one (type/message) or is an array; otherwise fall through to the
existing parent/root walk. Fixes react-hook-form#13726.
@bluebill1049
bluebill1049 merged commit bc5fec5 into react-hook-form:master Sep 10, 2026
6 checks passed
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.

schemaErrorLookup treats a nested error container as the field's own error on exact-name lookup

2 participants