Ignore stale responses in loadStatus when status reads overlap

オープン
#720 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
electron, javascript, react
領域
frontend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
JavaScript
スター
66
フォーク
20
平均マージ
1日 18時間
マージ済み PR(30日)
22

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

WordPress/contributor-toolkit のほかの issue

WordPress/contributor-toolkit の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。