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={visible()}> throws React #467 when the gate resolves during a replayed mount #8652
<Hydrate when={visible()}> sometimes throws React #467 ("Update hook called on initial render") from HydrationBoundary in hydration/visible.tsx. During hydration it is followed by #422 and the boundary is client-rendered, so the server HTML and the deferred hydration are lost for that section.
HydrationBoundary suspends on the gate before it calls its only hook:
If the gate resolves after use(g.p) suspends but before React abandons that render, React replays the suspended mount. The replay passes the gate and reaches useEffect, but the first attempt recorded no hooks and the fiber has no alternate, so React throws #467. It depends on timing, which is why it is intermittent in an app.
GenericHydrate avoids this: HydrationGate has no hooks and the effects live in HydratedBoundary.
A component rendered before the boundary reveals it from a microtask during a transition re-render, while the boundary is still showing its fallback. onRecoverableError receives "Update hook called on initial render" at visible.tsx, and React recovers with a synchronous render of the whole root.
Steps to Reproduce the Bug
pnpm nx run @tanstack/react-start-client:test:unit -- src/tests/visible.test.tsx on main with the test above added.
Activity