Skip to content

Key React.Children.map results like React - #400

Draft
davesnx wants to merge 1 commit into
mainfrom
fix/children-map-keys
Draft

davesnx wants to merge 1 commit into
mainfrom
fix/children-map-keys

Conversation

@davesnx

@davesnx davesnx commented Sep 19, 2026

Copy link
Copy Markdown
Member

React.Children.map and mapWithIndex returned mapped children without keys. A React 19.1 development client therefore reported Each child in a list should have a unique "key" prop for a mapped React.list or React.array, where React keys the same children silently. Split out of #399, which adds the Flight validation states this fix is visible through.

  • Every mapped element with a key slot (Lower_case_element, Client_component, Suspense) gets the key React's mapChildren assigns: .<index in base 36> for an unkeyed member, .$<key> for a keyed member with = and : escaped as =0 and =2, and a <mapped key>/ prefix when the callback returns an element with a different key.
  • Results without a key slot, such as text, pass through unchanged. A single element input is still mapped directly, without a key.
  • React.Children.toArray is unchanged.

The rules are copied from mapIntoArray, getElementKey, escape, and escapeUserProvidedKey in react@19.1.0.

Evidence at 01360e0: dune build @packages/react/runtest runs the new Children.map keys case, which checks index keys, base 36 at the eleventh member, keyed and escaped input, callback-key prefixing, slash doubling, text pass-through, mapWithIndex, and the single-element path.

Test Successful in 0.001s. 50 tests run.

Risk: two-way door. A revert restores unkeyed mapped children and the false missing-key warning. Mapped children that already had a key keep it under the .$ prefix, as in React; nothing else reads these keys.

@vercel

vercel Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
server-reason-react Ready Ready Preview Sep 19, 2026 9:00am UTC

Request Review

@github-actions

Copy link
Copy Markdown

Benchmarks

No baseline from main available yet, showing absolute values only.

Benchmark ops/sec
trivial/renderToStaticMarkup 3,262,780
trivial/renderToString 2,942,132
depth/10 81,305
depth/25 31,904
depth/50 16,323
depth/100 8,193
width/10 49,317
width/100 5,108
width/500 937.96
width/1000 475.22
table/10 32,345
table/50 6,949
table/100 2,964
table/500 647.97
props/small 12,939
props/medium 4,496
props/large 1,530
realworld/ecommerce24 8,129
realworld/ecommerce48 4,342
realworld/dashboard 33,950
realworld/blog50 5,237
realworld/form 17,658
primitive/React.string 20,370,588
primitive/React.int 10,835,195
primitive/React.null 33,447,400
primitive/createElement_empty 14,344,405
primitive/createElement_children 1,174,250
primitive/React.array_10 1,164,147
primitive/React.array_100 128,388
primitive/React.list_10 1,176,754
primitive/React.list_100 126,884
rsc/trivial 417,551
rsc/depth/50 6,267
rsc/width/100 655.37
rsc/width/500 119.05
rsc/width/1000 55.32
rsc/table/100 332.76
rsc/table/500 61.17
streaming/renderToStream/wide100 4,600
streaming/renderToStream/suspense-drained 47,902
rsc/render_html/wide100 660.32
rsc/render_html/suspense 19,786
rsc/render_model/wide100 1,373
router/match/static-small-first 24,059,335
router/match/static-small-last 35,277,222
router/match/static-large-first 36,329,177
router/match/static-large-last 35,879,575
router/match/static-large-miss 3,485,475
router/match/dynamic-large-first 2,349,213
router/match/dynamic-large-last 2,616,316
router/endpoint/static-large-last 19,807,630
router/endpoint/dynamic-large-last 2,398,984
router/parse/path-plain 2,401,010
router/parse/path-encoded 1,751,677
router/parse/search 3,074,765

This branch was successfully deployed

1 active deployment
Preview — 01360e03 Deployed Sep 19, 2026 by vercel[bot]
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.

1 participant