docs+test: root-cause dev-only <html> attribute strip after hydration
Diagnosis of the reported regression where a pre-hydration inline script's
class/attribute on <html> is stripped after hydration in next dev (works in
16.2.11, broken on the 16.3 line; production unaffected).
Root cause: the vendored React reconciler upgrade in #92945
(19.3.0-canary-fef12a01-20260413 -> da9325b5-20260417, first shipped in
16.3.0-canary.3). The App Router enables React StrictMode by default in dev
(__NEXT_STRICT_MODE_APP), and React's dev-only double-invoke-effects now
disappears+reappears the root <html>/<head>/<body> HostSingletons on initial
mount. release/acquireSingletonInstance strip every attribute off the live
node and re-apply only React's props, wiping the script-seeded class.
Confirmed via published-canary bisect (canary.2 good, canary.3 bad) and a
crossover swap of only the vendored React bundle (isolates the cause to React,
not Next.js code). Exact path: flushPassiveEffects -> commitDoubleInvokeEffects
InDEV -> doubleInvokeEffectsOnFiber -> reappearLayoutEffects ->
acquireSingletonInstance('html').
Fix belongs upstream in React (make singleton release/acquire a no-op during
the dev double-invoke); validated locally by guarding both paths. Dev
workaround: reactStrictMode: false. See NOTES.md.
- Harden the repro test to gate its assertion on a post-hydration effect so it
cannot false-pass before the strip.
- Add NOTES.md with the full root-cause writeup, verdict, and workaround.
Showing
Please
register
or
sign in
to comment