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
Commit edb3e36
Browse filesBrowse the repository at this point in the historyBrowse files
Arm clientOnly's swap without an owner so sibling hydration ids stay aligned
A hydrated clientOnly desynced DOM bookkeeping for every FOLLOWING sibling:
the client half armed its post-settle swap with onSettled, which registers a
tracked effect — a non-transparent owner, and every such owner consumes one
of the component's child ids at creation. The server half's only owner is the
fallback mirror memo, so the client ran one id ahead: a sibling created after
the clientOnly derived its hydration id one slot past the server's (_hk=30
server, key 40 asked), its template claim missed the registry, and insert
tracked a freshly-cloned phantom node that was never inserted (insertExpression
skips while hydrating). The DOM looked correct — the unclaimed server node
just stayed put — until the sibling's first post-hydration re-render
reconciled against the detached phantom and inserted the new content beside
the orphaned server node instead of replacing it. First surfaced as duplicated
nodes after an HMR hot-swap of a component following a clientOnly; any
signal-driven element swap in a following sibling hits it.
The swap is now armed through sharedConfig.onHydrationEnd — the ownerless
"all hydration complete" channel (waits for pending streamed boundaries,
microtask-fires when already done) — so clientOnly consumes exactly one child
id on both sides. New parity-harness scenario client-only-sibling-update pins
the contract: a resolving clientOnly followed by an element-swapping hole,
asserting the post-settle update REPLACES (both loaded and streamed modes).
Co-authored-by: Cursor <[email protected]>
Fix hydrated `clientOnly` desyncing DOM bookkeeping for following siblings. The client half's post-settle swap was armed with `onSettled`, which registers a tracked effect — an id-consuming owner the server half (whose only owner is the fallback mirror memo) never mints. Every sibling created after a hydrated `clientOnly` therefore derived its hydration id one slot past the server's, its template claim missed the registry, and `insert` tracked a never-inserted phantom node: the sibling's first post-hydration re-render reconciled against the phantom and inserted the new content beside the orphaned server node instead of replacing it (first surfaced as duplicated nodes after an HMR hot-swap of a component following a `clientOnly`). The swap is now armed through `sharedConfig.onHydrationEnd` — the ownerless "all hydration complete" channel — so `clientOnly` consumes exactly one child id on both sides.
0 commit comments