more test coverage for experimental plugin-rsc features

Aperta
#1,071 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à
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
react, typescript

Direzione di ricerca

Inizia individuando le API setOnClientReference e setRequireModule di @vitejs/plugin-rsc/ssr, quindi trova i percorsi del codice per generateResourcesCode e preloadDeps. Aggiungi test per gli argomenti del callback, gli accessi ripetuti, il comportamento di onLoad e entrambe le impostazioni di cssLinkPrecedence, incluse le dipendenze JavaScript e CSS e l’attributo precedence.

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

Descrizione

plugin: rsc

Summary

We've landed several experimental features in @vitejs/plugin-rsc that currently lack dedicated test cases. We should add tests to exercise these code paths and ensure they work correctly.

Features needing test coverage

1. onClientReference callback (#1065)

The new setOnClientReference API allows frameworks to be notified when client reference dependencies are loaded during SSR.

import { setOnClientReference, type OnClientReference } from '@vitejs/plugin-rsc/ssr'

const callback: OnClientReference = ({ id, deps }) => {
  // id: client reference module id
  // deps: { js: string[], css: string[] }
}

setOnClientReference(callback)

Test cases needed:

  • Callback is invoked when a client reference is accessed during SSR
  • Callback receives correct id and deps (both js and css arrays)
  • Callback is called on every access (not memoized)
  • setRequireModule with onLoad callback works correctly
2. cssLinkPrecedence option (#1064)

The new cssLinkPrecedence option controls whether CSS links use React's precedence attribute.

rsc({
  cssLinkPrecedence: false, // disable React's precedence attribute on CSS links
})

Test cases needed:

  • When true (default): CSS links include precedence attribute
  • When false: CSS links are rendered without the precedence attribute
  • Both generateResourcesCode and preloadDeps respect the setting

Related PRs

  • #1065 - feat(plugin-rsc): add callback to be notified when client reference dependencies are loaded
  • #1064 - feat(plugin-rsc): allow to control whether CSS links use React's precedence attribute
Lingua principale
TypeScript
Stelle
1.2k
Fork
287
Merge medio
1g 17h
PR unite (30g)
19

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 vitejs/vite-plugin-react

Tutte le issue di vitejs/vite-plugin-react

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.