[storage] signal is not updated during hydration when doing SSR or SSG
Maintainer thường phản hồi trong vòng 1 ngày
@atk đang làm issue này rồi.
Từ ngày 8/9/2024.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Describe The Problem To Be Solved
Reproduce by creating a new solid-start project from the bare template with SSR and change the line in Counter.tsx to:
const [count, setCount] = makePersisted(createSignal(0));
(Sorry I couldn't find a stackblitz template with solid-start.)
If you increase the counter and then reload the page, the counter isn't rendered and you get in the console:
Counter.tsx:7 Unable to find DOM nodes for hydration key: 0-0-0-0-0-0-0-0-0-1-0-0-0-0-2-1-0-0-2-1
Similarly, using Astro's client:load directive (which does server-side render or generate the HTML in SSG-mode), on page-load the counter is always 0.
Suggest A Solution
While it's unavoidable that the initial HTML contains 0 (since we cannot know the value of localStorage on the server), ideally storage would update the signal during or after hydration to read out the value from localStorage.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.6k
- Fork
- 162
- Merge trung bình
- 19 giờ 40 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
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-community/solid-primitives
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
solidjs-community/solid-primitives#1059 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
solidjs-community/solid-primitives#1060 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
solidjs-community/solid-primitives#1055 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
solidjs-community/solid-primitives#1000 · 3 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
solidjs-community/solid-primitives#894 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của solidjs-community/solid-primitives
Issue tương tự
-
ADD openalgoĐang mởtemplate
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
vercel/ai#21528 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug Needs: Triage :mag:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/fluentui-contrib#671 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sveltejs/acorn-typescript#150 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100