Run React Refresh at vite:afterUpdate instead of after a fixed 16 ms
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript, vite
- Área
- build-system, frontend
Línea de trabajo
Start in packages/common/refresh-runtime.js, where enqueueUpdate is a debounce with a 16 ms delay that runs the hooks and then performReactRefresh. Look at how the client emits vite:afterUpdate and where validateRefreshBoundaryAndEnqueueUpdate is called. Done means flushing the pending refresh on vite:afterUpdate while the timer still covers enqueues outside an update. Check the timing in the existing refresh tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Drafted with an AI assistant (Claude), reviewed by me.
Related plugins
- plugin-react
Description
React Refresh runs 16 ms after the last accepted module (packages/common/refresh-runtime.js, 6.3.0):
const enqueueUpdate = debounce(async () => {
if (hooks.length) await Promise.all(hooks.map((cb) => cb()))
performReactRefresh()
}, 16)
So every Fast Refresh edit waits at least 16 ms after its modules have run.
We see it in TanStack Router, which waits for the pass through __registerBeforePerformReactRefresh before applying a route edit: an edit of only a route's loader went from 16.9 to 36.8 ms save-to-DOM when we started waiting (1,485-route app).
Suggested solution
By the time the client emits vite:afterUpdate, every module of the payload has run its accept callback, so every validateRefreshBoundaryAndEnqueueUpdate call of that update has been made. Flush there, and keep the timer for enqueues outside an update:
import.meta.hot.on('vite:afterUpdate', () => flushPendingRefresh())
Alternative
Keep the debounce but expose a way to flush it.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines
- Read the docs
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.2k
- Forks
- 287
- Merge medio
- 1 d 17 h
- PR fusionados (30 d)
- 19
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de vitejs/vite-plugin-react
-
plugin-rsc: a client reference's CSS is linked before the CSS of the chunks it imports (build)Posiblemente ocupada @wozhenbang2004 la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
vitejs/vite-plugin-react#1570 ·
Los mantenedores suelen responder en 1 día
-
pending triage
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
vitejs/vite-plugin-react#1581 ·
Los mantenedores suelen responder en 1 día
-
[plugin-rsc] Build exits 0, but the app fails at runtime: a server action imported only by browser code is missing from the RSC buildPosiblemente ocupada @NeilPant la tomó hace 3 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
vitejs/vite-plugin-react#1578 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
vitejs/vite-plugin-react#1577 ·
Los mantenedores suelen responder en 1 día
-
[plugin-rsc] inline "use server" function declarations lose hoisting and throw TDZ ReferenceErrorPosiblemente ocupada @draarivpatel-ui la tomó hace 2 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
vitejs/vite-plugin-react#1566 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de vitejs/vite-plugin-react
Issues similares
-
ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
mermaid-js/mermaid-v13#1370 ·
Los mantenedores suelen responder en 1 día
-
compiler: the island_chunks_not_emitted report gives a count but not which islands were skippedAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Broken Website
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
darkreader/darkreader#16259 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
ARTPARK-SAHAI-ORG/calibrate-frontend#919 ·
Los mantenedores suelen responder en 1 día