AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

TurbopackRustReactCompiler Renames Lowercase JSX Intrinsic Tags When Shadowed Variable Is Passed As Prop

With experimental.turbopackRustReactCompiler enabled, a shadowed local variable named like an HTML intrinsic (e.g., `table`) that is passed as a JSX prop causes the compiler to rename the lowercase `<table>` tag to `<table_0>`, leading to unrecognized element and hydration mismatch. The bug requires a specific combination: a `const table = useReactTable(...)`, a nested shadowing `const table`, passing the outer `table` as a prop, and an early return causing server/client structural difference.

highConfidence 85%Next.jsAffected V16.3.0-Canary.78

Origin Analysis

The Rust React Compiler applies SSA identifier renaming to all JSX identifier names, including lowercase intrinsic tags. In JSX, lowercase tag names are host components and must be emitted as string literals, not as identifier references. When a variable with the same name is shadowed, the renamer changes the JSX tag name from `table` to `table_0`, producing an invalid element. The Babel React Compiler correctly handles this case by treating lowercase tags as strings.
1. Create Next.js app on 16.3.0-canary.78 with App Router, Turbopack. 2. Enable `reactCompiler: true` and `experimental.turbopackRustReactCompiler: true` in next.config.ts. 3. Add client component with `const table = useReactTable(...)`, a nested shadowing `const table` in useEffect, pass outer `table` as prop to Toolbar, and early return `if (isLoading) return ...`. 4. Run `next dev`, open page, evaluate `document.getElementsByTagName('table_0').length`; it returns 1 and hydration errors appear.

Fixing Code Block

Edge Case Audit

The hotfix only skips renaming for lowercase JSX identifiers; it does not affect uppercase component names. However, if a custom component name begins with lowercase (a discouraged pattern), it would now break because it would be treated as an intrinsic. Rollback advice: revert this patch and instead rename the shadowing variable or disable `experimental.turbopackRustReactCompiler` until an official fix is released. Additionally, this change should be accompanied by unit tests covering all lowercase intrinsic tags and the exact shadowing scenario.

Ecosystem Topology