Skip to content

Respond to App Shell prefetches on the server#93998

Merged
acdlite merged 1 commit into
canaryfrom
acdlite/app-shells/02-server
May 21, 2026
Merged

Respond to App Shell prefetches on the server#93998
acdlite merged 1 commit into
canaryfrom
acdlite/app-shells/02-server

Conversation

@acdlite
Copy link
Copy Markdown
Contributor

@acdlite acdlite commented May 20, 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

Tests Passed

Commit: 2155d1a

@acdlite acdlite force-pushed the acdlite/app-shells/02-server branch from 68c6aa4 to dbcb57d Compare May 20, 2026 23:22
@acdlite acdlite marked this pull request as ready for review May 20, 2026 23:27
Base automatically changed from acdlite/app-shells/01-flag to canary May 20, 2026 23:37
@acdlite acdlite force-pushed the acdlite/app-shells/02-server branch from dbcb57d to d439c90 Compare May 20, 2026 23:37
@acdlite acdlite requested review from lubieowoce and unstubbable May 21, 2026 03:18
@acdlite acdlite force-pushed the acdlite/app-shells/02-server branch from d439c90 to c829ac8 Compare May 21, 2026 03:19
Comment thread packages/next/src/server/request/params.ts Outdated
Comment thread packages/next/src/server/request/search-params.ts Outdated
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.
@acdlite acdlite force-pushed the acdlite/app-shells/02-server branch from c829ac8 to 2155d1a Compare May 21, 2026 16:08
@acdlite acdlite merged commit bf52993 into canary May 21, 2026
164 of 165 checks passed
@acdlite acdlite deleted the acdlite/app-shells/02-server branch May 21, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants