Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

CHEATSHEET.md and RFC 02 still recommend module-scope state for app-wide state (follow-up to #3390)

Đang mở Phù hợp với người mới
#4,141 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
1/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
86/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, typescript
Lĩnh vực
documentation

Hướng nghiên cứu

Đọc packages/solid/CHEATSHEET.md quanh dòng 353 và documentation/solid-2.0/02-signals-derived-ownership.md quanh dòng 93, sau đó so sánh hướng dẫn trong hai tài liệu với cách diễn đạt trong JSDoc của createContext và hướng dẫn quản lý trạng thái phiên bản 2.0. Cập nhật hai câu đã lỗi thời để giải thích rằng provider quản lý trạng thái của cây con và toàn bộ ứng dụng, đặc biệt là khi dùng SSR, còn phạm vi module chỉ dành cho các hằng số. Hoàn tất khi cả hai tài liệu đưa ra hướng dẫn nhất quán.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Follow-up to #3390 / #3395, which fixed the createContext JSDoc. Two other copies of the same guidance were not updated and still say the opposite of the 2.0 docs (checked on next at d2ad8b28):

  • packages/solid/CHEATSHEET.md, line 353 ("Context, components, lazy"): "If you want truly app-wide state, don't use Context — a module-scope signal/store is a global."
  • documentation/solid-2.0/02-signals-derived-ownership.md, line 93: the same sentence.

The cheatsheet copy matters most, because it is the one written for AI tools:

  • It ships in the package (node_modules/solid-js/CHEATSHEET.md, 2.0.0-rc.15 included).
  • The README's "For LLMs / AI assistants" section and the new solid-2.0 primer skill both point agents to it.
  • scripts/build-cheatsheet-skill.mjs publishes it as the solid-2.0-cheatsheet skill.

So agents that follow Solid's own guidance learn the rule the docs reversed on 2026-09-07 (solid-docs 413890c, "recommend context over module state"). Concepts → Reactivity, Components and JSX → Context, and the State management guide all say to prefer a provider, and to use module scope only for constants and the createContext call.

Suggested fix: replace both sentences with the wording #3395 put in the JSDoc:

Context is for state that belongs to a subtree, which includes app-wide state in an app that renders on the server: a value created inside a component is created once per request, and the Provider owns and disposes it. Module scope is shared by every request in the same process, so reserve it for constants.

Optionally, add the client-only nuance from the State management guide: without ssr: true, a module-scope store is one store per tab, but it becomes shared server state the day SSR is turned on, so creating it in a provider from the start is the portable choice.

Ngôn ngữ chính
TypeScript
Star
36.1k
Fork
1.1k
Merge trung bình
11 giờ 45 phút
Pull request đã merge (30 ngày)
329

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của solidjs/solid

Tất cả issue của solidjs/solid

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.