Repository navigation
fix: keep Turbopack HMR chunk lists stable across routes - #102216
Closed
zhengdaodeguL wants to merge 1 commit into
Closed
zhengdaodeguL wants to merge 1 commit into
zhengdaodeguL wants to merge 1 commit into
Conversation
Fixes vercel#102210 <!-- NEXT_JS_LLM -->
Contributor
Contributor
Author
|
Closing this PR — it was submitted from a stale fork base (133 commits behind canary), so the diff picked up unrelated upstream changes and shows conflicts. I will re-submit the same fix on the current canary. Sorry for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Keeps Turbopack Server HMR working when an App Router instrumentation client dynamically imports a module used by multiple routes.
Why?
The routes shared one evaluated client chunk group and therefore reused its HMR chunk-list path. Route-specific async loader names made that list's contents change with the last requested route, causing conflicting effects for the same key and forcing Server HMR to re-evaluate modules.
How?
Give the shared App Router client runtime an HMR list identifier derived from the page entry while retaining the shared evaluated chunk group. Add a development regression test for two routes, the dynamic instrumentation import, chunk-list stability, and lazy module loading.
Fixes #102210
Verification
pnpm test-dev-turbo test/development/app-dir/instrumentation-client-hmr/instrumentation-client-hmr.test.tspassed on the fixed build. The test also failed on the canary-source control, as expected./,/other,/all returned 200. Cumulative Server HMR failures / effect conflicts were 0 / 0, 0 / 0, 0 / 0 on the fix. On base57edfeac4440da9a9e78e3d05f7ba5ef53d6a105, the counts were 0 / 0, 1 / 1, 2 / 2; the shared chunk-list SHA-256 flipped from00444309481660eead7d2a2b5567030de0f5379799bebff4f4a575d65f78595eto3d8eab12e42462390a4d410c1219869a8a4b5462104731ecb8a566f7bbf8f0b1and back. The base regression test failed its chunk-list stability assertion.cargo fmt --all -- --check, Prettier, ESLint, andgit diff --checkpassed.