fix(Tunnel): render tunnelled children in the first commit - #3022
Conversation
Coverage Report for ./packages/components/
File CoverageNo changed files found. |
✅ Visual Regression Tests PassedAll visual snapshots match the committed baselines. |
🚀 Preview DeploymentPreview environments are ready:
Images:
|
✅ Cross-Version Tests PassedThe current host still renders old published remote versions correctly (iframe) and in the same DOM shape (in-process). Iframe harness (attribute-accurate): ✅ passed In-process harness (structure-only): ✅ passed |
6b561a3 to
20099a5
Compare
Two different failures in one shard — and one of them may not be this branch's
The 109 are infrastructure, not this PRAll of them are Worth naming: while the runners are this slow, the The 3 are real, and probably predate this branch
But the likely cause may be
So a firefox-only regression from #3046 would currently be invisible on The decisive test costs one run: trigger the visual suite with firefox on current I have not re-run anything for the 109, since with the runners in this state a rerun is a coin flip rather than a fix. 🤖 Addressed by Claude Code |
A `TunnelExit` mounting on the client rendered nothing until the entries had committed, so tunnelled content arrived one commit late. Anything that inspects the DOM in a layout effect only ever sees the first commit — react-aria's `useSlot` decides there whether a slotted `<Label>` exists. For `Slider`, whose `<Label>` is tunnelled into the value row, it decided "no label": the slider had no accessible name on first paint and react-aria warned in every dev run (#3015). The render-phase children were built as exactly that bridge, but the exit only opted into them while `useIsSSR()` was true, which is never the case in a client-only mount. Opt in before the first commit as well. The flag flips in a layout effect, never during render, so repeated render invocations before a commit stay idempotent and SSR hydration keeps matching. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
20099a5 to
75053fa
Compare
Part of #3015. Split out of the original PR: this one carries only the
react-tunneldefect and its tests. The docs and story fixes moved to #3050.The defect:
react-tunneldropped tunnelled children from the first commitSlidertunnels its<Label>into the value row.TunnelExitfell back to render-phase children only whileuseIsSSR()was true — never the case on a client-only mount. So the first commit contained no<label>at all, react-aria'suseSlotconcluded there was none, and warned. The slider genuinely had no accessible name until the next render.Introduced in de72c80 (#2827), which replaced the ungated
getEntries(id)with anisSsr-gated read and so kept only the server half of the bridge its own comment describes. The fix restores the client half: the flag is flipped in a layout effect, never during render, so repeated render invocations before a commit (StrictMode double-invoke, concurrent re-render) all read the same value and SSR hydration stays free of mismatches. From the first commit on, the committed children stay authoritative — even when empty.This affects every tunnelled slot, not just
Slider.Verified
pnpm nx test:browser react-tunnel23/23 on this branch, rebased onto currentmain(1.1.4).No visual test was added: the settled DOM is unchanged — only the first pre-paint frame differs.
run-visual-testsis on this PR so the suite confirms that rather than us assuming it.🤖 Generated with Claude Code