server hmr and client hmr triggered by a shared module change cause temporary inconsistent render
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- react, typescript, vite
Rechercherichtung
Starte zunächst packages/plugin-rsc/examples/hmr und untersuche den Ablauf von App, Item und der gemeinsamen lookup.ts. Reproduziere den Fehler, indem du lookup.ts änderst oder Server- und Client-Module gemeinsam speicherst. Erledigt ist die Aufgabe, wenn HMR-Aktualisierungen für Server und Client konsistent gerendert werden, ohne dass die RSC-Antwort und der Client-Code unterschiedliche Modulversionen verwenden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 1.2k
- Forks
- 287
- Ø Merge
- 1 T. 17 Std.
- Gemergte PRs (30 T.)
- 19
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus vitejs/vite-plugin-react
-
plugin-rsc: a client reference's CSS is linked before the CSS of the chunks it imports (build)Evtl. vergeben @wozhenbang2004 hat das vor 7 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
vitejs/vite-plugin-react#1570 ·
Maintainer antworten meist innerhalb von 1 Tag
-
pending triage
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
vitejs/vite-plugin-react#1581 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[plugin-rsc] Build exits 0, but the app fails at runtime: a server action imported only by browser code is missing from the RSC buildEvtl. vergeben @NeilPant hat das vor 4 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
vitejs/vite-plugin-react#1578 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
vitejs/vite-plugin-react#1577 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[plugin-rsc] inline "use server" function declarations lose hoisting and throw TDZ ReferenceErrorEvtl. vergeben @draarivpatel-ui hat das vor 3 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
vitejs/vite-plugin-react#1566 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in vitejs/vite-plugin-react
Ähnliche Issues
-
good first issue help wanted
Schwierigkeit 2/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
Intelligenza-Umana/intelligenza-umana-web#16 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
open-webui/open-webui#35184 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
danielmiessler/LifeOS#3001 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Maintainer antworten meist innerhalb von 1 Tag