Run React Refresh at vite:afterUpdate instead of after a fixed 16 ms
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- react, typescript, vite
- 領域
- build-system, frontend
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 1.2k
- フォーク
- 287
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 19
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vitejs/vite-plugin-react のほかの issue
-
plugin-rsc: a client reference's CSS is linked before the CSS of the chunks it imports (build)対応中かも @wozhenbang2004 が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
vitejs/vite-plugin-react#1570 ·
メンテナーはふだん 1 日以内に返信
-
pending triage
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
vitejs/vite-plugin-react#1581 ·
メンテナーはふだん 1 日以内に返信
-
[plugin-rsc] Build exits 0, but the app fails at runtime: a server action imported only by browser code is missing from the RSC build対応中かも @NeilPant が 3 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
vitejs/vite-plugin-react#1578 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
vitejs/vite-plugin-react#1577 ·
メンテナーはふだん 1 日以内に返信
-
[plugin-rsc] inline "use server" function declarations lose hoisting and throw TDZ ReferenceError対応中かも @draarivpatel-ui が 2 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
vitejs/vite-plugin-react#1566 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
vitejs/vite-plugin-react の issue をすべて見る
似ている issue
-
ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
mermaid-js/mermaid-v13#1370 ·
メンテナーはふだん 1 日以内に返信
-
compiler: the island_chunks_not_emitted report gives a count but not which islands were skippedオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
Broken Website
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
darkreader/darkreader#16259 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ARTPARK-SAHAI-ORG/calibrate-frontend#919 ·
メンテナーはふだん 1 日以内に返信