Skip to content

fix: keep FileList intact in flatten, expand it in jsonToFormData, skip undefined - #13725

Merged
bluebill1049 merged 2 commits into
react-hook-form:masterfrom
soroush5:fix-formdata-submission-fidelity
Sep 10, 2026
Merged

bluebill1049 merged 2 commits into
react-hook-form:masterfrom
soroush5:fix-formdata-submission-fidelity

Conversation

@soroush5

Copy link
Copy Markdown
Contributor

Fixes #13724.

  • flatten() now treats FileList as a leaf (same guard 🐞 fix(flatten): preserve File and Blob values as leaf nodes #13652 added for File/Blob), so file fields are no longer split into field.0 keys.
  • jsonToFormData() appends each file in a FileList under its own field name (matching native form submission) and skips undefined values instead of stringifying them.

Verified: new tests in flatten.test.ts/formData.test.ts fail on master (3 failures) and pass with the fix; neighbor suites (form.test.tsx, extractFormValues) pass, tsc --noEmit and eslint are clean.

@bluebill1049
bluebill1049 merged commit d542d35 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.

File inputs submitted through <Form> arrive under "field.0" keys, undefined becomes the string "undefined"

2 participants