Skip to content

partial fallbacks: only upgrade shells with remaining prerenderable params#91158

Merged
ztanner merged 5 commits into
canaryfrom
03-10-partial_fallbacks_properly_gate_on_generatestaticparams
Mar 14, 2026
Merged

partial fallbacks: only upgrade shells with remaining prerenderable params#91158
ztanner merged 5 commits into
canaryfrom
03-10-partial_fallbacks_properly_gate_on_generatestaticparams

Conversation

@ztanner

@ztanner ztanner commented Mar 10, 2026

Copy link
Copy Markdown
Member

Partial fallback upgrading is currently too broad. Any PPR fallback shell can be treated as upgradeable, including routes with no generateStaticParams and shells that are already as specific as prerendering can make them.

In practice, that means we preserve allowQuery and enable background promotion for shells that should remain as partial fallbacks. That broadens the feature beyond the medium-cardinality case it was meant for and makes the build output imply per-param upgradeability when there are no prerenderable params left to fill.

This PR teaches static-path generation to compute remainingPrerenderableParams for each fallback shell: the unresolved pathname params that can still be filled by generateStaticParams in that branch. We then use that signal to gate partial fallback behavior.

With this change:

  • partialFallback is only emitted for shells that still have prerenderable params remaining
  • allowQuery with params is only preserved for those shells

Effectively, this limits partial fallback upgrading to shells that can still be made more specific by prerendering.

ztanner commented Mar 10, 2026

Copy link
Copy Markdown
Member Author

@nextjs-bot

nextjs-bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Tests Passed

@nextjs-bot

nextjs-bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Stats from current PR

✅ No significant changes detected

📊 All Metrics
📖 Metrics Glossary

Dev Server Metrics:

  • Listen = TCP port starts accepting connections
  • First Request = HTTP server returns successful response
  • Cold = Fresh build (no cache)
  • Warm = With cached build artifacts

Build Metrics:

  • Fresh = Clean build (no .next directory)
  • Cached = With existing .next directory

Change Thresholds:

  • Time: Changes < 50ms AND < 10%, OR < 2% are insignificant
  • Size: Changes < 1KB AND < 1% are insignificant
  • All other changes are flagged to catch regressions

⚡ Dev Server

Metric Canary PR Change Trend
Cold (Listen) 455ms 456ms ▁█▁▁▁
Cold (Ready in log) 438ms 438ms ▂▇▁▁▁
Cold (First Request) 1.294s 1.300s ▃▇▃▂▃
Warm (Listen) 456ms 456ms ▁█▁▁▁
Warm (Ready in log) 442ms 442ms ▁▇▁▁▁
Warm (First Request) 346ms 342ms ▁▇▂▁▁
📦 Dev Server (Webpack) (Legacy)

📦 Dev Server (Webpack)

Metric Canary PR Change Trend
Cold (Listen) 457ms 458ms ▁▁▁▁▁
Cold (Ready in log) 451ms 453ms ▁▆█▆▆
Cold (First Request) 2.061s 2.063s ▁▃▇▄▃
Warm (Listen) 507ms 457ms ▁▁█▁▁
Warm (Ready in log) 468ms 450ms ▁▆█▆▆
Warm (First Request) 2.064s 2.061s ▁▃▅▃▃

⚡ Production Builds

Metric Canary PR Change Trend
Fresh Build 3.942s 3.893s ▁▇▁▂▁
Cached Build 3.909s 3.923s ▁▆▁▂▁
📦 Production Builds (Webpack) (Legacy)

📦 Production Builds (Webpack)

Metric Canary PR Change Trend
Fresh Build 15.304s 15.335s ▁▂▅▁▁
Cached Build 15.086s 15.409s ▁▂▅▁▁
node_modules Size 481 MB 481 MB █████
📦 Bundle Sizes

Bundle Sizes

⚡ Turbopack

Client

Main Bundles: **408 kB** → **408 kB** ✅ -9 B

80 files with content-based hashes (individual files not comparable between builds)

Server

Middleware
Canary PR Change
middleware-b..fest.js gzip 771 B 761 B 🟢 10 B (-1%)
Total 771 B 761 B ✅ -10 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 450 B 450 B
Total 450 B 450 B

📦 Webpack

Client

Main Bundles
Canary PR Change
5528-HASH.js gzip 5.54 kB N/A -
6280-HASH.js gzip 59.6 kB N/A -
6335.HASH.js gzip 169 B N/A -
912-HASH.js gzip 4.59 kB N/A -
e8aec2e4-HASH.js gzip 62.6 kB N/A -
framework-HASH.js gzip 59.7 kB 59.7 kB
main-app-HASH.js gzip 256 B 251 B 🟢 5 B (-2%)
main-HASH.js gzip 39.2 kB 39.2 kB
webpack-HASH.js gzip 1.68 kB 1.68 kB
262-HASH.js gzip N/A 4.59 kB -
2889.HASH.js gzip N/A 169 B -
5602-HASH.js gzip N/A 5.55 kB -
6948ada0-HASH.js gzip N/A 62.6 kB -
9544-HASH.js gzip N/A 60.4 kB -
Total 233 kB 234 kB ⚠️ +727 B
Polyfills
Canary PR Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Total 39.4 kB 39.4 kB
Pages
Canary PR Change
_app-HASH.js gzip 194 B 194 B
_error-HASH.js gzip 183 B 180 B 🟢 3 B (-2%)
css-HASH.js gzip 331 B 330 B
dynamic-HASH.js gzip 1.81 kB 1.81 kB
edge-ssr-HASH.js gzip 256 B 256 B
head-HASH.js gzip 351 B 352 B
hooks-HASH.js gzip 384 B 383 B
image-HASH.js gzip 580 B 581 B
index-HASH.js gzip 260 B 260 B
link-HASH.js gzip 2.51 kB 2.51 kB
routerDirect..HASH.js gzip 320 B 319 B
script-HASH.js gzip 386 B 386 B
withRouter-HASH.js gzip 315 B 315 B
1afbb74e6ecf..834.css gzip 106 B 106 B
Total 7.98 kB 7.98 kB ✅ -1 B

Server

Edge SSR
Canary PR Change
edge-ssr.js gzip 125 kB 125 kB
page.js gzip 266 kB 266 kB
Total 391 kB 391 kB ⚠️ +264 B
Middleware
Canary PR Change
middleware-b..fest.js gzip 616 B 614 B
middleware-r..fest.js gzip 156 B 155 B
middleware.js gzip 43.8 kB 43.7 kB
edge-runtime..pack.js gzip 842 B 842 B
Total 45.4 kB 45.3 kB ✅ -165 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 715 B 718 B
Total 715 B 718 B ⚠️ +3 B
Build Cache
Canary PR Change
0.pack gzip 4.2 MB 4.19 MB 🟢 6.41 kB (0%)
index.pack gzip 108 kB 107 kB
index.pack.old gzip 108 kB 107 kB 🟢 1.48 kB (-1%)
Total 4.41 MB 4.4 MB ✅ -8.88 kB

🔄 Shared (bundler-independent)

Runtimes
Canary PR Change
app-page-exp...dev.js gzip 331 kB 331 kB
app-page-exp..prod.js gzip 179 kB 179 kB
app-page-tur...dev.js gzip 331 kB 331 kB
app-page-tur..prod.js gzip 179 kB 179 kB
app-page-tur...dev.js gzip 327 kB 327 kB
app-page-tur..prod.js gzip 177 kB 177 kB
app-page.run...dev.js gzip 328 kB 328 kB
app-page.run..prod.js gzip 177 kB 177 kB
app-route-ex...dev.js gzip 75.9 kB 75.9 kB
app-route-ex..prod.js gzip 51.6 kB 51.6 kB
app-route-tu...dev.js gzip 75.9 kB 75.9 kB
app-route-tu..prod.js gzip 51.6 kB 51.6 kB
app-route-tu...dev.js gzip 75.5 kB 75.5 kB
app-route-tu..prod.js gzip 51.4 kB 51.4 kB
app-route.ru...dev.js gzip 75.5 kB 75.5 kB
app-route.ru..prod.js gzip 51.4 kB 51.4 kB
dist_client_...dev.js gzip 324 B 324 B
dist_client_...dev.js gzip 326 B 326 B
dist_client_...dev.js gzip 318 B 318 B
dist_client_...dev.js gzip 317 B 317 B
pages-api-tu...dev.js gzip 43.3 kB 43.3 kB
pages-api-tu..prod.js gzip 32.9 kB 32.9 kB
pages-api.ru...dev.js gzip 43.2 kB 43.2 kB
pages-api.ru..prod.js gzip 32.9 kB 32.9 kB
pages-turbo....dev.js gzip 52.6 kB 52.6 kB
pages-turbo...prod.js gzip 38.5 kB 38.5 kB
pages.runtim...dev.js gzip 52.6 kB 52.6 kB
pages.runtim..prod.js gzip 38.5 kB 38.5 kB
server.runti..prod.js gzip 62.4 kB 62.4 kB
Total 2.94 MB 2.94 MB ⚠️ +4 B
📎 Tarball URL
https://vercel-packages.vercel.app/next/commits/a63d9aee024237bb4d00ebe754541e4e1dcdfece/next

@ztanner ztanner force-pushed the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch from b0d48aa to d781a43 Compare March 10, 2026 19:33
@ztanner ztanner marked this pull request as ready for review March 10, 2026 19:36
@ztanner ztanner requested a review from ijjk March 10, 2026 19:36
Comment thread packages/next/src/build/index.ts Outdated
@ztanner ztanner force-pushed the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch from d781a43 to 43c3ec0 Compare March 10, 2026 22:54
@ztanner ztanner force-pushed the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch from 43c3ec0 to 1094433 Compare March 11, 2026 01:44

@gnoff gnoff left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the tests demonstrate more complex examples. for instance if you have multiple params and they all are available via gSP at least one vs when only some are available via gSP

@ztanner ztanner changed the base branch from canary to graphite-base/91158 March 12, 2026 00:18
@ztanner ztanner force-pushed the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch from 1094433 to 76e8322 Compare March 12, 2026 00:18
@ztanner ztanner changed the base branch from graphite-base/91158 to ztanner/empty-shell-memory-cache March 12, 2026 00:18
Comment thread packages/next/src/build/templates/app-page.ts Outdated
@ztanner ztanner force-pushed the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch 2 times, most recently from 2d4f86a to 9e3bc3a Compare March 12, 2026 00:34
@ztanner ztanner changed the base branch from ztanner/empty-shell-memory-cache to graphite-base/91158 March 12, 2026 01:50
@ztanner ztanner force-pushed the graphite-base/91158 branch from 73fc64e to b4efbdb Compare March 12, 2026 01:50
@ztanner ztanner force-pushed the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch from 9e3bc3a to 1d62a5f Compare March 12, 2026 01:50
@ztanner ztanner changed the title partial fallbacks: properly gate on generateStaticParams partial fallbacks: only upgrade shells with remaining prerenderable params Mar 12, 2026
@ztanner ztanner force-pushed the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch from 1d62a5f to 3260155 Compare March 12, 2026 14:52
@ztanner ztanner changed the base branch from graphite-base/91158 to canary March 12, 2026 14:52
@codspeed-hq

codspeed-hq Bot commented Mar 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 17 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing 03-10-partial_fallbacks_properly_gate_on_generatestaticparams (3260155) with canary (1411870)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@ztanner ztanner force-pushed the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch from 3260155 to a63d9ae Compare March 12, 2026 18:27
@ztanner ztanner force-pushed the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch from a63d9ae to 967f390 Compare March 12, 2026 20:58

ztanner commented Mar 14, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Mar 14, 12:34 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 14, 12:35 AM UTC: @ztanner merged this pull request with Graphite.

@ztanner ztanner merged commit cf4d3ae into canary Mar 14, 2026
286 of 288 checks passed
@ztanner ztanner deleted the 03-10-partial_fallbacks_properly_gate_on_generatestaticparams branch March 14, 2026 00:35
ztanner added a commit that referenced this pull request Mar 14, 2026
…91231)

In #91158, I wired up the plumbing to indicate whether a partial
fallback shell is upgradeable. The previous heuristic was too coarse.
This wires up the handling in `next start`.

This PR teaches the runtime to complete a fallback shell only as far as
prerendering allows. Instead of promoting a generic shell like
`/[one]/[two]` directly to `/c/foo`, it promotes it to the most specific
prerendered shell for that branch, `/c/[two]`, where `[one]` has
`generateStaticParams`. That means later requests can reuse the more
complete shell, while fully dynamic params continue to stream as dynamic
content.

With this change:

- the first request still serves the generic fallback shell immediately
- the background revalidate writes a more specific shell, not a fully
concrete route
- later requests for the same prerendered branch reuse that shell
- upgrading stops once only fully dynamic params remain

This keeps the runtime behavior aligned with the build-time
`remainingPrerenderableParams` contract from the downstack PR.
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants