[2.0 RC] SSR hydration keys shift when memo()-wrapped prop getters are read before `children` through `<Dynamic>`, so the child never hydrates
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Start by tracing server-side ssrElement prop processing and how hydration keys are allocated for children; compare those allocations with the client behavior described in the report. Use the linked StackBlitz reproduction and run its install, build, and render commands, then serve build/ and toggle the signal. Done when the child claims the matching server key and updates the in-document span.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
A component rendered through <Dynamic component="button"> can receive props whose values are ternaries over a logical expression. The compiler emits these as memo(() => …)() ? a : b getters. On the server, each read of such a getter creates a sync memo, and that memo takes a child id from the owner that is current during ssrElement's prop loop. That owner is the same one that later allocates the hydration key for the element's children. The getters are read before children, so the server's key for the child is shifted by the number of memo-wrapped props. The client doesn't make the same allocations, so it looks for the unshifted key.
As a result, the child misses hydration. The client builds a detached copy, the server-rendered node stays in the document with nothing bound to it, and later reactive updates to the child never reach the page.
We first saw this with Kobalte 2.0.0-alpha.2's Dialog.Trigger / DropdownMenu.Trigger (Button → Polymorphic → Dynamic). The repro below doesn't use Kobalte; it only copies Kobalte's prop layering.
Your Example Website or App
https://stackblitz.com/edit/solidjs-templates-gftulnlj?file=package.json
Steps to Reproduce the Bug or Issue
npm install && node build.mjs && node render.mjs- Serve
build/statically and openindex.html. - In the console, run
toggle().
Expected behavior
Expected behavior:
The server gives the child the key that follows the button's key, matching the client:
<button _hk=50 type="button"><span _hk=51 id="label">label</span></button>
The client claims <span _hk=51>, and after toggle() the in-document span gets data-on.
Actual behavior:
The server skips three ids before the child:
<main _hk=0><button _hk=50 type="button"><span _hk=54 id="label">label</span></button></main>
The client (development build) warns:
Hydration key miss for "51": no server-rendered element carries this key (template: <span id=label>label). A detached element was created instead; its subtree will not appear in the document or become interactive. …
Hydration completed with 1 unclaimed server-rendered node(s): <span _hk="54" id="label">label</span>
After toggle(), the span in the document is still _hk="54" with no data-on. The update went to the detached client copy.
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version: Version 154.0.8037.97 (Official Build) (x86_64)
Additional context
None.
- Ngôn ngữ chính
- TypeScript
- Star
- 36.1k
- Fork
- 1.1k
- Merge trung bình
- 13 giờ 13 phút
- Pull request đã merge (30 ngày)
- 306
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ó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Dev diagnostics: ABANDONED_FLIGHTS fires on streamed frame slot args that supersede by designĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Per-scope takeover for live nodes whose server value is still streaming (D8 follow-up to #3817)Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/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ự
-
feat(subscription): add Manage Subscription (Stripe portal) to the Subscription tab plan cardĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature] 通知栏合并重复消息并显示次数Đang mởarea:ui enhancement issue-form:feature platform:cross-platform review: high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
1lck/Lithe-IDEA#1092 ·
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 72/100
developmentseed/deck.gl-raster#693 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Marker-Inc-Korea/AutoRAG#1801 ·
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 72/100
iii-hq/iii#2278 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày