Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#419 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript, vite

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

@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.

Lingua principale
TypeScript
Stelle
522
Fork
73
Merge medio
1g 5h
PR unite (30g)
34

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di solidjs/solid-vite-plugin

Tutte le issue di solidjs/solid-vite-plugin

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.