nextjs - ✅(Solved) Fix useActionState with form containing file input receives missmatched FormData [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#93822Fetched 2026-05-14 03:28:00
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
1
Timeline (top)
referenced ×4commented ×1cross-referenced ×1issue_type_added ×1

Fix Action

Fixed

PR fix notes

PR #36468: [FlightReply] Don't drop FormData entries in decodeReplyFromBusboy

Description (problem / solution / changelog)

Fixes a regression from #36425 where referenced FormData entries can be dropped by decodeReplyFromBusboy when files are interleaved with text fields in the payload.

decodeReplyFromBusboy queues text fields that arrive while a file is being streamed and flushes them after the last file's 'end', working around busboy emitting 'end' deferred relative to subsequent 'field' events. With multiple files interleaved with text, this loses the relative order of the affected text entries. The reorder was a long-standing but invisible issue — entries came back in the wrong order but were all present — until #36425 tightened how referenced FormData entries are collected from the backing store to rely on them being contiguous. With that assumption violated, referenced FormDatas can now come back with some entries dropped. The pattern is most easily surfaced through useActionState actions that return the submitted FormData as part of their state.

This replaces the tail-flush with a positionally-tagged buffer drained in arrival order. flush() walks from a monotonic index pointer, resolving text immediately and files once their 'end' has fired, and holding later entries when the cursor lands on a still-streaming file. The backing FormData now matches the payload's order, restoring the contiguity assumption (and fixing the long-standing reorder as a side effect). The same change is applied to all five copies in react-server-dom-{webpack,turbopack,parcel,esm,unbundled}. Two new tests cover the multi-file interleave.

fixes vercel/next.js#93822

Changed files

  • package.json (modified, +1/-0)
  • packages/react-server-dom-esm/src/server/ReactFlightDOMServerNode.js (modified, +83/-21)
  • packages/react-server-dom-parcel/src/server/ReactFlightDOMServerNode.js (modified, +83/-21)
  • packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerNode.js (modified, +83/-21)
  • packages/react-server-dom-unbundled/src/server/ReactFlightDOMServerNode.js (modified, +83/-21)
  • packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMReplyNode-test.js (added, +149/-0)
  • packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js (modified, +83/-21)
  • yarn.lock (modified, +13/-0)

Code Example

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 32401
  Available CPU cores: 20
Binaries:
  Node: 24.15.0
  npm: 11.12.1
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.3.0-canary.19 // Latest available version is detected (16.3.0-canary.19).
  eslint-config-next: N/A
  react: 19.2.6
  react-dom: 19.2.6
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/DarkendHall/next_16.2.6_file_input_form_issues

To Reproduce

  1. Run npm run dev
  2. Navigate to http://localhost:3000
  3. Type something into the textarea
  4. Select a file
  5. Open the console
  6. Submit the form, all looks good, FormData matches.
  7. Resubmit the form and the formdata on the client side and the server side will be different

Current vs. Expected behavior

I expect the FormData that reaches the server to match the one on the client side and also be back to the client. Instead every other time the form is submitted only the attachments field seems to reach the server while being present on the client side.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 32401
  Available CPU cores: 20
Binaries:
  Node: 24.15.0
  npm: 11.12.1
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.3.0-canary.19 // Latest available version is detected (16.3.0-canary.19).
  eslint-config-next: N/A
  react: 19.2.6
  react-dom: 19.2.6
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Server Actions

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local)

Additional context

Working as expected in:

  • 16.2.4
  • 16.3.0-canary.11

Not working as expected in:

  • 16.2.5
  • 16.2.6
  • 16.3.0-canary.12 (seems this is the version where it broke)

Noticed CI tests failing when dependabot tried bumping the next version to 16.2.6 from 16.2.4

Tested with Chrome 148.0.7778.168 64-bit

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix useActionState with form containing file input receives missmatched FormData [1 pull requests, 1 comments, 2 participants]