Replace server fields with typed dev state#94591
Draft
timneutkens wants to merge 1 commit into
Draft
Conversation
Contributor
Failing test suitesCommit: 7eea785 | About building and testing Next.js
Expand output● instant-navigation-testing-api › renders runtime-prefetched content instantly during navigation ● instant-navigation-testing-api › runtime params are excluded from instant shell › does not include cookie values in instant shell during page load |
Contributor
Stats cancelledCommit: 7eea785 |
16001ef to
165caad
Compare
b5c6320 to
a83f2fe
Compare
165caad to
7eea785
Compare
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?
Replace the generic
serverFieldsbag with typed development server state and explicit render-server commands.Why?
The string-keyed mutation API mixed serializable state, commands, router-local values, and startup dependencies. This made the render-server boundary difficult to reason about and allowed stale or unrelated fields to accumulate.
How?
Add
DevServerStateand typed incremental updates, construct middleware matchers inside the render server, pass the router handler as an explicit server option, keep root not-found state in the dev bundler, and replace env propagation withreloadEnv().Verification
pnpm --filter=next typespnpm test-dev-turbo test/development/middleware-dev-update/middleware-dev-update.test.tspnpm test-dev-webpack test/development/middleware-dev-update/middleware-dev-update.test.tspnpm test-dev-turbo test/e2e/env-config/env-config.test.ts -t "with hot reload"pnpm test-dev-webpack test/e2e/env-config/env-config.test.ts -t "with hot reload"pnpm test-dev-turbo test/development/app-dir/hmr-intercept-routes/hmr-intercept-routes.test.tspnpm test-dev-turbo test/e2e/app-dir/not-found/basic/index.test.ts -t "should use the not-found page for non-matching routes|should render the 404 page when the file is removed"pnpm test-dev-turbo test/e2e/instrumentation-hook/instrumentation-hook.test.ts -t "with-node-page should run the instrumentation hook"pnpm test-dev-turbo test/e2e/next-image-new/app-dir/app-dir.test.ts -t "should load the images"