Skip to content

fix(handleSubmit): accept nullish outputs with disabled fields - #13999

Merged
bluebill1049 merged 3 commits into
react-hook-form:masterfrom
wozhenbang2004:patch-5
Nov 7, 2026
Merged

bluebill1049 merged 3 commits into
react-hook-form:masterfrom
wozhenbang2004:patch-5

Conversation

@wozhenbang2004

Copy link
Copy Markdown
Contributor

Proposed Changes

A resolver's transformed value can be null or undefined. When a field is registered with disabled: true, handleSubmit tries to remove that field from the nullish result. This throws before onValid runs and prevents submit state from completing.

Skip disabled-field cleanup for a top-level nullish result. Pass the transformed value through unchanged and preserve the existing cleanup behavior for object results.

Add three cases covering null/undefined outputs, callback return values and completed submit state, plus top-level/nested disabled-field removal without mutating the resolver's original object. The two nullish cases fail against the original implementation.

Validation with Node 22:

  • 133 suites, 1,835 unit tests and 26 snapshots passed.
  • All 90 existing Chromium E2E tests passed with one worker and no retries, using a local browser/server configuration. E2E test files and assertions are unchanged.
  • Type checking, type tests, lint, Prettier, builds, export checks and both API Extractor checks passed. No added lint warnings; the API report is unchanged.

Type of change

  • Bug fix

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

Skip disabled-field cleanup when a resolver returns null or undefined so the submit callback and form state complete normally. Preserve disabled-field removal for object outputs.
Verify null and undefined transformed data reaches onValid, callback return values and submit state complete, and disabled object fields are still omitted without mutating the resolver output.
@bluebill1049
bluebill1049 merged commit 6d2122d into react-hook-form:master Nov 7, 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.

2 participants