Respond to App Shell prefetches on the server#93998
Merged
Merged
Conversation
Contributor
Tests PassedCommit: 2155d1a |
68c6aa4 to
dbcb57d
Compare
dbcb57d to
d439c90
Compare
d439c90 to
c829ac8
Compare
unstubbable
approved these changes
May 21, 2026
lubieowoce
approved these changes
May 21, 2026
Introduces a new prefetch request type — the App Shell — and the server-side handler that renders it. With this PR, a client (or a test harness) can issue a request with `NEXT_ROUTER_PREFETCH_HEADER: '3'` and receive the param-independent shell of a route: param- and searchParam-bearing segments suspend, leaving everything that doesn't depend on them intact. The App Shell render is a subtype of the existing runtime prerender, distinguished by a single bit on the prerender store. When that bit is set, `await params` and `await searchParams` both hang forever, so any segment that depends on either suspends to its nearest fallback. The "shell" of the route is whatever renders above those suspense boundaries — layouts, cookie-derived UI, and other request-context-derived content. Static shell prefetches are not covered by these changes; those will be addressed by a future PR and use a slightly different strategy. (Instead of creating a new response type, the existing static prefetch response will be updated to support extraction of the shell via "rewinding", similar to what we do for cached navigations.) No client-side changes yet, only the server parts.
c829ac8 to
2155d1a
Compare
unstubbable
approved these changes
May 21, 2026
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.
Introduces a new prefetch request type — the App Shell — and the server-side handler that renders it. With this PR, a client (or a test harness) can issue a request with
NEXT_ROUTER_PREFETCH_HEADER: '3'and receive the param-independent shell of a route: param- and searchParam-bearing segments suspend, leaving everything that doesn't depend on them intact.The App Shell render is a subtype of the existing runtime prerender, distinguished by a single bit on the prerender store. When that bit is set,
await paramsandawait searchParamsboth hang forever, so any segment that depends on either suspends to its nearest fallback. The "shell" of the route is whatever renders above those suspense boundaries — layouts, cookie-derived UI, and other request-context-derived content.Static shell prefetches are not covered by these changes; those will be addressed by a future PR and use a slightly different strategy. (Instead of creating a new response type, the existing static prefetch response will be updated to support extraction of the shell via "rewinding", similar to what we do for cached navigations.)
No client-side changes yet, only the server parts.