server hmr and client hmr triggered by a shared module change cause temporary inconsistent render
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- react, typescript, vite
調査の方向性
まず packages/plugin-rsc/examples/hmr を実行し、App、Item、共有されている lookup.ts のフローを確認します。lookup.ts を変更するか、サーバーモジュールとクライアントモジュールを同時に保存して、失敗を再現します。サーバーとクライアントの HMR 更新が一貫してレンダリングされ、RSC レスポンスとクライアントコードが異なるモジュールバージョンを使用しない状態になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Related plugins
Describe the bug
Raising as requested by @hi-ogawa
I've created a reproduction of the issue. The reproduction is where there's a module used on both the client and the server. A change to this shared module throws an error because the server rsc fetch uses the latest version of the module but the client code uses the old version of the module.
There is another way to reproduce the problem without a shared module. Edit a server module and client module at the same time. So make changes to them both without saving individually and then press save all to save them both together.
The problem in a nutshell is that the rsc fetch uses the latest code and the subsequent client render uses the old code.
Reproduction
Steps to reproduce
The App just renders a client Item component passing in a key which It gets from 'lookup.ts'. The Item passes this key into 'lookup.ts' to get the value which it then displays. If you edit the key in 'lookup.ts' from 'a' to 'b', for example, then the hmr update throws.
export const key = 'b'
The reason for the error is that the server response uses the latest 'lookup.ts' but the client uses the old 'lookup.ts'. So the rsc response has the key 'b' but the client still has the key 'a'.
System Info
System:
OS: macOS 14.6.1
CPU: (8) arm64 Apple M1 Pro
Memory: 78.34 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
pnpm: 10.13.1 - ~/.nvm/versions/node/v22.12.0/bin/pnpm
bun: 1.2.5 - ~/.nvm/versions/node/v22.12.0/bin/bun
Watchman: 2024.10.07.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 138.0.7204.184
Safari: 17.6
npmPackages:
@vitejs/plugin-react: latest => 4.7.0
@vitejs/plugin-rsc: latest => 0.4.16
vite: ^7.0.4 => 7.0.4
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
- 主要言語
- 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 が 7 日前に担当しました。 オープン
難易度 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 が 4 日前に担当しました。 オープン
難易度 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 が 3 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
vitejs/vite-plugin-react#1566 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
vitejs/vite-plugin-react の issue をすべて見る
似ている issue
-
good first issue help wanted
難易度 2/5 1時間未満 初心者へのやさしさ 86/100
Intelligenza-Umana/intelligenza-umana-web#16 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
open-webui/open-webui#35184 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
danielmiessler/LifeOS#3001 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信