You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
<Hydrate when={never()}> renders nothing when it mounts after client-side navigation #8668
A <Hydrate when={never()}> boundary that first mounts during client-side navigation stays empty. Its children never render, the deferred chunk is never requested, and nothing is logged.
NeverGate (packages/react-start-client/src/hydration/never.tsx) suspends on neverPromise on every client render, including mounts where no server HTML was preserved. The marker ref also calls replaceChildren() in that case.
Gating both on shouldPreserveServerHTMLRef.current fixed it in a local patch of the published dist/esm/hydration/never.js:
function NeverGate(props) {
if (isServer ?? typeof window === "undefined") return props.children;
+ if (!props.preserve) return props.children;
if (!reactUse) throw neverPromise;
...
- if (!shouldPreserveServerHTMLRef.current) element.replaceChildren();- else saveFallbackHtml(id, element);+ if (shouldPreserveServerHTMLRef.current) saveFallbackHtml(id, element);
...
- jsx(NeverGate, { children: props.children })+ jsx(NeverGate, { preserve: shouldPreserveServerHTMLRef.current, children: props.children })
I don't know what the replaceChildren() call guards against, so this may be incomplete. Happy to open a PR with a regression test.
AI disclosure: drafted with an AI assistant (Claude), which also built and ran the reproducer. I reviewed it before posting.
Activity