Course map
Stage 1: App Router Foundations
Stage 2: The Rendering Model
Stage 3: Data, Caching and Mutations
Stage 4: Full-Stack Next.js
Stage 5: Production and Specialization

Part 08 / Topic 3 of 7

generateStaticParams decides the shell — not what's inside it

A PNR status checker, harness/app/status/[pnr]/page.tsx, built the same way Part 2's product page was: generateStaticParams lists two known PNRs, and a third real record exists in the data (harness/app/status/lib/pnr.ts) but is deliberately left out:

export function generateStaticParams() {
  return [{ pnr: "2458001234" }, { pnr: "2458005678" }];
}

Part 2's product page could afford to be fully static (○) for its listed ids, because its lookup was synchronous — no await, nothing to stream. This page's lookup is genuinely slow (lookupPnr simulates a 900ms upstream PNR check) and sits behind a <Suspense> boundary, so the build table looks different:

$ npm run build
...
├   /status/[pnr]
│ ├ ◐ /status/[pnr]
│ ├ ◐ /status/2458001234
│ └ ◐ /status/2458005678

Both listed PNRs are ◐, not ○ — even though they were prerendered. Reading the actual bytes next build wrote settles why:

$ python3 -c "print(open('.next/server/app/status/2458001234.html').read().count('Karnataka'))"
0
$ python3 -c "print('Checking PNR status' in open('.next/server/app/status/2458001234.html').read())"
True

The prerendered HTML for a listed PNR contains the Suspense fallback text and nothing else — not the train name, not the status. generateStaticParams only ever decided which URLs get a prerendered shell to serve instantly; it never promised the data inside a Suspense boundary gets baked in too. That second decision belongs to "use cache" (previewed in section 5, taught fully in Stage 3) — without it, an uncached async read streams fresh on every single request, listed param or not.

Requesting the one real-but-unlisted PNR, 2458009999, and a truly unknown one, 0000000000, against a running production build:

$ curl -s -D - http://localhost:PORT/status/2458009999 | grep -i x-nextjs
x-nextjs-stale-time: 300
x-nextjs-prerender: 1
x-nextjs-postponed: 1
$ curl -s -D - http://localhost:PORT/status/0000000000 | grep -i x-nextjs
x-nextjs-stale-time: 300
x-nextjs-prerender: 1
x-nextjs-postponed: 1

Identical headers to a listed PNR. x-nextjs-prerender: 1 here means "served from the prerendered [pnr] App Shell template," the same shell every PNR under this route shares — unlisted ids are not a worse-case fallback, they reuse the exact same mechanism. x-nextjs-postponed: 1 on every single request (listed or not) confirms section 3's finding again from the runtime side: nothing about PnrDetails is ever served purely from the prerendered artifact — it always resumes dynamic rendering, because nothing caches it.

The unknown PNR is the sharpest proof of "static shell, dynamic status": notFound() runs inside PnrDetails, after the 200 shell has already started streaming. Confirmed directly:

$ curl -s -o /dev/null -w "%{http_code}\n" http://localhost:PORT/status/0000000000
200
$ curl -s http://localhost:PORT/status/0000000000 | grep -o 'noindex\|could not be found'
noindex
could not be found

The real, documented behavior, reproduced rather than quoted: a 200 with <meta name="robots" content="noindex"> and Next.js's own "This page could not be found" UI, not a 404. Once a shell starts streaming, the status code is already committed (Part 7, section 7, same underlying rule).

Full files: examples/01-pnr-data-lib.ts, examples/02-pnr-status-dynamic-segment-page.tsx.

Done here? The practice set for Part 8 — including the solutions — is on the part page.

Search the guide