Ignore stale responses in loadStatus when status reads overlap

Abierto
#720 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
electron, javascript, react
Área
frontend

Línea de trabajo

Start in src/renderer/hooks/use-site-status.jsx and read loadStatus to see where each response writes state, metaPatchRef and statusLoading. Then follow the callers: the focus reload in index.jsx, the build-end reload in use-site-scripts.jsx, and the site:status handler in main.js that reads meta before Git. Done means a counter in a ref lets only the latest call apply its result, and the setup chain in index.jsx no longer acts on a superseded response.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

loadStatus in src/renderer/hooks/use-site-status.jsx applies every response it gets, in the order they come back. Two calls can overlap, for example the window-focus reload (index.jsx) and the reload a build's end triggers (use-site-scripts.jsx). If the older one finishes last, it puts back the state it read before the newer one.

What that can show:

  • buildFailed, installFailed or hasBuilt from before a build or install ended, so the setup checklist reads a failed build as complete, or the other way round.
  • statusLoading cleared by the older call while the newer one is still running.

site:status in main.js reads the site's meta before its Git reads, so an older call can read the meta before the outcome is written and still finish after the newer call.

Found by CodeRabbit on #716, which made buildFailed come from loadStatus like installFailed already does. It was deferred there because the race exists on trunk for the other fields too.

A likely fix: a request counter in a ref, applying the state, metaPatchRef and statusLoading only for the latest call. The callers that use the returned status (the setup chain in index.jsx) need checking too, so they don't act on a response that has been superseded.

Lenguaje dominante
JavaScript
Estrellas
66
Forks
20
Merge medio
1 d 18 h
PR fusionados (30 d)
22

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de WordPress/contributor-toolkit

Todos los issues de WordPress/contributor-toolkit

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.