action is not tree-shakeable: read-only apps bundle the form path and signals' optimistic lanes (~3–4 KB br)
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
- 45/100
- Loại issue
- Tái cấu trúc
- Độ 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
- performance
Hướng nghiên cứu
Start from the router's source for setupNativeEvents and createRouterContext (form-submit interception and submission state), plus the module exporting action from @solidjs/router. Map which symbols pull verdictValue, dissolveLane, laneRead, isPending and latest from @solidjs/signals, then design the import-time registration seam so importing action installs them. Done means: a bundle of examples/hackernews without import { action } drops those symbols (~3–4 KB brotli, measured via solidjs/solid's scripts/size harness), while a bundle with action behaves identically — form interception, submissions and optimistic state unchanged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
A read-only app (no forms, no mutations — examples/hackernews in solidjs/solid is the canonical case) still bundles the router's action machinery: the form-submit interception in setupNativeEvents, the submission state wired in createRouterContext, action's own glue, and — through it — the optimistic-lane machinery from @solidjs/signals. None of it is reachable from the app's code, but the router core references it statically, so tree-shaking cannot remove it.
Proposal: make action self-installing. The core keeps a tiny seam (a submit hook + a submissions slot); import { action } from "@solidjs/router" registers the form path and the lane-backed submission state into that seam at import time. An app that never imports action bundles none of it. No laziness, no async — plain import-driven tree-shaking, the same shape Solid uses for its own opt-in features.
Measurements
Taken with solidjs/solid's size harness (scripts/size, Rolldown bundle, brotli) on @solidjs/[email protected] against solid-js / @solidjs/web 2.0.0-rc.13 — see solidjs/solid#3838 (page: base + router scenario). Local macOS / Node 26; minified bytes are exact, brotli ±tens of bytes vs Linux CI.
| minified | brotli | |
|---|---|---|
| router standalone (solid/web external) | 32,430 | 11,216 |
| router's marginal cost on a server-component page | +38,779 | +12,137 |
Of the +38,779 min marginal:
- router's own code: 28,008 —
createRouterContext3,029 ·setupNativeEvents2,398 (includes the form-action path) ·querycache 1,814 ·setupLinkClaims1,486 ·actionglue ≈ 2,360 · scroll restoration 788 ·browserHistory594 · … - retained from
@solidjs/signals: +8,583 — pulled byaction: the optimistic lanes (verdictValue,dissolveLane,laneRead),isPending/latest,createEffect,onSettled - retained from the server-function client: +1,188 (
GET/decodeResponse—query's, legitimately) - retained from
@solidjs/web: +1,137 (takeHydrationValue,registerElementClaim) - retained from
solid-js: +364
For a read-only app the action-attributable part is roughly the action glue + the form path inside setupNativeEvents + the signals lane machinery — on the order of 11–13 K minified, ≈ 3–4 KB brotli, carried for a feature the app never imports.
For scale: the router's standalone 11.2 KB br is larger than the entire eager frames (server-components) client after this week's size pass (10.9 KB), and about two-thirds of the whole solid-js + @solidjs/web hydrating runtime.
What "done" looks like
- An app importing
Router/ routes /A/useNavigate/query/preloadbut notactionbundles no form-submit interception, no submission state, and none of signals' lane machinery (verdictValue,dissolveLane,laneRead,isPending,latestabsent from the bundle unless the app uses them itself). - An app that imports
actionbehaves exactly as today (form interception, submissions, optimistic state) — the registration is at import time, synchronous, no behaviour change. - Measurable: a variant of solidjs/solid's
page: base + routerscenario (or anexamples/hackernewsscenario) with and withoutimport { action }; expected delta ≈ 3–4 KB brotli on the read-only variant.
Secondary candidates (same shape, smaller)
Scroll restoration (788 min) and the form path in setupNativeEvents could follow the same import-driven pattern. query / preload is the read side and should stay in the core.
Method, for reproduction
The attribution came from solidjs/solid's scripts/size/attribute.mjs over the harness bundle (per-function minified bytes; module-level reachability via the bundler's graph). Removing action's reach is measurable on an edited copy of the router's dist/ through the same bundler before any source change — happy to share the scripts.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.3k
- Fork
- 182
- Merge trung bình
- 19 giờ 2 phút
- Pull request đã merge (30 ngày)
- 36
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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-router
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
solidjs/solid-router#654 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
solidjs/solid-router#643 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
<A> costs ~6us of server CPU per instance during SSR (20x a plain <a>), mostly mergeProps/splitPropsCó thể đã có người làm @birkskyum đã nhận 59 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
solidjs/solid-router#583 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
solidjs/solid-router#569 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
solidjs/solid-router#518 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của solidjs/solid-router
Issue tương tự
-
DB-plane provider_chat_options.* is accepted by config set but never merged into the loaded configĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bump Firebase JS SDK (12.19.0 → 13.0.0)Có thể đã có người làm @SelaseKay đã nhận hôm nay. Đang mởNeeds Attention type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
invertase/react-native-firebase#9364 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
clouflaure de fernandoĐang mởenhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
cloudflare/mcp#271 ·
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 82/100
Maintainer thường phản hồi trong vòng 4 ngày
-
[fullsend] E2E: rhdh-version-override — run-e2e.sh overrides RHDH_VERSION to non-existent 2.1Đang mởe2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
redhat-developer/rhdh-plugin-export-overlays#4261 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày