Skip to content

Update JSXS implementation & Timestamp for client-side cache busting - #1082

Merged
AbhinRustagi merged 7 commits into
mainfrom
abhin/devtools-key-warning
Aug 26, 2026
Merged

Update JSXS implementation & Timestamp for client-side cache busting#1082
AbhinRustagi merged 7 commits into
mainfrom
abhin/devtools-key-warning

Conversation

@AbhinRustagi

@AbhinRustagi AbhinRustagi commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What

  • Fixes the false Each child in a list should have a unique "key" prop warnings the devtools widget threw for plain static JSX (e.g. the Debug splitter's decorative spans).
  • Root cause: the browser bundle's react/jsx-runtime shim aliased jsxs to jsx and left children inside props.children, so React key-checked hand-written static children as if they were dynamic lists.
  • Adds a 5-minute time bucket to alias CDN URLs (@latest, major, minor) so a republished bundle reaches running apps quickly; exact pins stay fully cacheable. Bumps devtools to 0.1.2.

How the shim maps each case now

Both runtime functions take the same three arguments: (type, props, key). Children always arrive inside props.children (a single value for one child, an array for several), and key always arrives as the separate 3rd argument, never inside props. The compiler picks the function: jsx when it can't prove the children are static, jsxs when it counted them in the source. createElement expects the opposite layout — children positional, key inside props — so the shim relocates both and picks the argument shape that preserves the compiler's static/dynamic verdict:

You write Passed to the runtime Shim calls Result
<br /> jsx("br", {}, undefined) — no children, no key createElement("br", {}) nothing to validate
<div id="x"><Spinner /></div> jsx("div", {id: "x", children: spinner}, undefined) — one child, sits in props createElement("div", {id: "x"}, spinner) — lone positional arg single child trusted, no key asked
<div><a /><b /></div> jsxs("div", {children: [a, b]}, undefined)jsxs = compiler-proven static array createElement("div", {}, a, b) — array spread into varargs static siblings trusted, no false warning (this was the bug)
<ul>{items.map(i => <li />)}</ul> — keys forgotten outer: jsx("ul", {children: [li, li]}, undefined); each item: jsx("li", {}, undefined) createElement("ul", {}, [li, li]) — one array arg, elements carry no key array stays visible → React warns, correctly: this list could reorder
<ul>{items.map(i => <li key={i.id} />)}</ul> — keys provided outer: same jsx call; each item: jsx("li", {}, i.id) — key lifted into arg 3 items: createElement("li", {key: i.id}) — key merged back into props; outer: same array arg array is key-checked, every element has one → passes clean

So the two dynamic-list rows differ only in whether the source provided keys — the shim just relays that truthfully: forgotten keys still warn, provided keys still arrive. The earlier per-element key="..." workarounds in DebugUI are dropped since the shim now translates faithfully.

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
openui-docs Ready Ready Preview Aug 26, 2026 12:52pm

Request Review

@AbhinRustagi AbhinRustagi changed the title fix: devtools key warning fix: devtools key warning & add GA for jsdelivr purge Aug 26, 2026
@AbhinRustagi AbhinRustagi changed the title fix: devtools key warning & add GA for jsdelivr purge [WIP] fix: devtools key warning & add GA for jsdelivr purge Aug 26, 2026
@AbhinRustagi AbhinRustagi changed the title [WIP] fix: devtools key warning & add GA for jsdelivr purge [WIP] fix: devtools key warning Aug 26, 2026
@AbhinRustagi AbhinRustagi changed the title [WIP] fix: devtools key warning Update JSXS implementation Aug 26, 2026
@AbhinRustagi
AbhinRustagi marked this pull request as ready for review August 26, 2026 12:37
@AbhinRustagi AbhinRustagi changed the title Update JSXS implementation Update JSXS implementation & Timestamp for client-side cache busting Aug 26, 2026
@AbhinRustagi
AbhinRustagi merged commit fa66572 into main Aug 26, 2026
4 checks passed
@AbhinRustagi
AbhinRustagi deleted the abhin/devtools-key-warning branch August 26, 2026 13:01
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