[2.0.4] SSR hydration: server/client key-sequence drift leaves interactive elements permanently dead after hydration
Maintainer thường phản hồi trong vòng 1 ngày
@leo7martins đang làm issue này rồi.
Từ ngày 27/11/2026.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript, vite
Hướng nghiên cứu
Start by reproducing the issue with the linked solid-hydration-repro app using pnpm install && pnpm dev, then compare server and client hydration key sequences around onSettled, <Show>, and scope slots. The report identifies these server/client asymmetries but does not name the Solid source files or tests to change. Done means the client claims the server-rendered nodes and the button works after hydration in both dev and production.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
In SSR + hydration mode, interactive elements can be left permanently dead
after hydration: they render in the server HTML, but never receive event
handlers or reactive bindings — in dev and, silently, in a prerendered
production build (zero console output there; the dev-only warnings don't
fire). Clicking simply does nothing, on every load.
Concretely (from the app where this was found): a navigation-rail menu
button renders fine in the served HTML but is completely unresponsive after
hydration — in both vite dev SSR and the prerendered production build.
The client created a detached clone of the button's subtree with all
handlers, while the server-rendered copy stays in the document
handler-less.
The cause is hydration-id drift: the server build consumes hydration ids in
places where the client build never does, so the server's id sequence runs
ahead of the client's. Once the drift exceeds what the client's later render
passes can absorb, hydration claiming fails for the whole subtree — with the
symptoms above. Three server/client asymmetries in solid-js 2.0.4 consume
server-only hydration ids:
-
onSettled— the server build is a reservation-only stub:function onSettled(callback) { const o = getOwner(); if (o?.id != null) getNextChildId(o); // consumes an id, callback never runs }The client runs the callback in a tracked effect and consumes nothing.
-
<Show>— the server build reserves a child id unconditionally for
non-keyedShow(if (o?.id != null && !props.keyed) getNextChildId(o););
the clientShowallocates nothing. -
Scope slots —
ssrScope/_scopeSlot/materializeIdexist only in
the server build;{props.children}/ JSX-prop slots consume hidden ids
server-side with no client counterpart.
These stack inside real component trees. A component chain rendered
through a JSX-prop <Show> boundary — custom-element wrappers, a tooltip
(with its focus-signal primitive), a dynamic() native button, more
<Show>s (icon/label/variant) and prop-slot renders — drifts the server
id sequence by a dozen+ ids for the subtree. Once the drift exceeds what
the client's later render passes happen to absorb, claiming fails
permanently for that subtree.
Your Example Website or App
https://github.com/mprovok/solid-hydration-repro
Steps to Reproduce the Bug or Issue
- Clone the linked repo and
cdinto it pnpm install && pnpm dev- Open the page and watch the dev-server console: on every load,
Hydration key misswarnings appear for the whole menu-button subtree
(client looks up keys like19h0; the server emitted19e0— visible
viacurl -s http://localhost:5173/ | grep -o '_hk=19e0'), ending
withHydration completed with 5 unclaimed server-rendered node(s)
listing the chain - You'll see a large vertical bar (the "navigation rail") on the left side of the screen and a smaller bar above it. Inside the small bar is a "button" (the rail's menu button) with a slightly darker blue background color. Click that button — nothing happens. The visible server
sm-buttonhas no delegated click handler
(typeof document.querySelector('sm-navigation-rail sm-button')._$$click === "undefined"); the reactive graph bound to a detached clone pnpm build && pnpm preview— the dead button reproduces in
production, silently: zero console output (all checks are dev-only),
same unclaimed server nodes, same dead click — this is the silent
production failure described at the top
Expected behavior
The client should claim the server-rendered nodes (matching hydration keys),
with no detached clones and no key misses. Interactive elements should stay
interactive after hydration, identically in dev and production.
If you enable the commented code in src/App.tsx so that onHydrationEnd is called, then after running pnpm build and pnpm preview, the button above the nav rail can be clicked and the width of the nav rail increases and decreases.
Screenshots or Videos
No response
Platform
- OS: Linux
- Browser: Chrome (headless + interactive)
- solid-js / @solidjs/web / @solidjs/signals: 2.0.4 (first found and
reproduced on 2.0.3 — both versions behave identically) - vite 8.3.8, @solidjs/vite-plugin 3.0.1, Node 26
Additional context
- Instrumenting
getNextChildIdon both the SSR bundle and the client chunk
shows the server consuming ids the client never allocates, and every later
hydration key in that owner branch shifting. - Patching only the server-side reservation (removing
getNextChildIdfrom
serverShow) over-shifts in the other direction, and mirroring the
reservation on the client does not realign the trees either — the two
compilers create theShowcomponents in different orders, so the id
protocols appear to have diverged beyond a single off-by-one. - Hand-written synthetic repros of the same chain produce the same warnings
but self-heal after hydration (a later render pass lands on the server
nodes by coincidence); the death needs the real tree's reservation
density, which is why the linked repo uses the real component sources.
Within that tree the death is insensitive to size and content: the app's
full navigation layout, the rail alone, the rail with zero navigation
items, the rail without its unrendered fab branch (a keyed<Show>with
function children — that form consumes no server id when false, unlike
non-keyed inline<Show>; the same holds for<For>with empty data, on
both sides), and the tree peeled component boundary by component boundary
(removing dead code and client-only wiring from the app's original tree,
then inlining components of the button chain into the menu button).
Two structural findings from the peeling: (a) a component boundary
itself is a protocol participant — flattening a component into its
parent while keeping its template merges the child elements into the
parent's template chunk and drops hydration-key reservations outright,
which plain nested elements in the same template don't; during the
flattening every remaining<Show>was kept — including never-rendered
label/outline branches, which still reserve — each step renumbered the
keys below and shrank the unclaimed set and the detached-clone count
(sm-buttonloses its standalone key when merged into its wrapper's
template chunk), and in dev and production the click stayed dead after
every step; (b) passingariaLabel/ariaLabelSelectedinstead of
tooltip titles on themenuButtonremoves the tooltip subtree
(div.anchor,sm-tooltip,sm-plain-tooltip) from the server render
outright, shrinks the unclaimed set 7→5 nodes and the detached clones
7→4 (keys renumber,001008c220→001008c30) — and the click still
stays dead. All of these fail the same way. - The reproduction is maximally sensitive to exactly one remaining
component boundary:MaterialTooltip(+MaterialPlainTooltip). In
the linked repro themenuButtonpasses only aria-labels, so the
tooltip component's internal<Show when={props.tooltip !== void 0}>
takes its fallback — it renders nothing extra, and the served HTML
contains no tooltip markup at all. Deleting the two tooltip components
and unwrapping their element heals the repro completely (re-verified on
2.0.4): 0 hydration key misses, 0 detached clones, and the menu button
is interactive in both dev and the production build. Keeping the
components — rendered or not — keeps the chain dead. This brackets the
mechanism precisely: the server-side id reservations accumulated across
the tree keep the client's claim sequence behind the server's by exactly
the headroom one template-chunk boundary covers, and the client's later
render passes absorb the rest only when that boundary disappears. - Production builds hide the warnings (dev-only), but the divergence and the
dead elements occur there too — verified withpnpm build && pnpm preview(same unclaimed server nodes, same dead click, zero warnings). - Baseline fingerprints on 2.0.4, for diffing your own run: the dev
hydration key misses are19h0,19h20,19h24,19h270,19h2730
against the server's (never-claimed)19e0,19e20,
19e24,19e270,19e2730on the menu-button chain, byte-identical
across loads and versions; production keys follow the same family
(_hk=001008c1on the menu button's icon-button wrapper). - Workaround known to the app that surfaced this (workaround only, not a
fix): keep the affected interactive element out of the server render and
the hydration pass by mounting it behind anonHydrationEndgate — the
rail hydrates fine and the button mounts live right after hydration,
but proper claiming with the server's id protocol remains broken.
- Ngôn ngữ chính
- TypeScript
- Star
- 37k
- Fork
- 1.2k
- Merge trung bình
- 8 giờ 43 phút
- Pull request đã merge (30 ngày)
- 365
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của solidjs/solid
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[2.0.4] Nested `<Errored>`: the outer boundary stays on an error the inner one rethrew, after the next error is one the inner one handlesCó thể đã có người làm @MilindChatrabhuji đã nhận 2 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của solidjs/solid
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
activepieces/activepieces#17974 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
OHDSI/Data2Evidence#3777 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AOSSIE-Org/PictoPy#1802 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Termix-SSH/Plugin-Snippets#26 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-reported bug from-app needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nightly-labs/openbot#20504 ·
Maintainer thường phản hồi trong vòng 1 ngày