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

Client setup seam: run app code before the generated entry's hydrate (start.clientSetup)

Đang mở
#419 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ó
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
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript, vite
Lĩnh vực
build-system, frontend

Hướng nghiên cứu

This is a design decision, not a ready-to-code task: the issue asks for a start.clientSetup option or a <ClientEntry /> component, and the maintainers have not chosen between them. Start with the code that generates the client entry and the existing start.instrument server hook, which the issue uses as the model. Done means a maintainer agrees on the API and the generated entry runs the setup module before hydrate.

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

Mô tả

@solidjs/vite-plugin 3.0.0-next.50, solid-js 2.0.0-rc.15.

The generated client entry calls hydrate straight away, and there is no place for app code that has to run in the browser before hydration. Our real cases:

  • Installing a server-function transport wrapper that detects a response from another build (version skew) and reloads. It must be in place before the first render fires the page's reads.
  • A request-header hook on that transport, for example a tenant selector header the server functions need.
  • Registering the vite:preloadError listener before any lazy route chunk loads.
  • Reading a third-party global that a classic <script> in <body> defines (Telegram's telegram-web-app.js). Today the generated entry is an async module in <head>, so its order relative to that script is not guaranteed. #411 / solidjs/solid#4002 fixed hydration itself here, but not setup code that reads globals.

Because of this we keep authored entry-client.tsx / entry-server.tsx pairs only to run three lines before hydrate. That means we also carry the Document + hydrate(…, document) boilerplate that the generated entries would give us.

Suggestion (either works for us):

  1. start.clientSetup: './src/client-setup.ts'. The generated client entry does await import(setup) (or a static import placed first) before hydrate. This mirrors start.instrument on the server.
  2. A <ClientEntry /> component that the document places where it wants (for example at the end of <body>), with the setup module option above.

Option 1 alone would let us delete both authored entries.

Ngôn ngữ chính
TypeScript
Star
522
Fork
73
Merge trung bình
1 ngày 4 giờ
Pull request đã merge (30 ngày)
35

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-vite-plugin

Tất cả issue của solidjs/solid-vite-plugin

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.