cloudflare / cloudflare/vinext
App Router: include PPR dynamic routes in routes-manifest `dynamicRoutes` regardless of `revalidate`
- Dominant language
- TypeScript
- Stars
- 8.8k
- Forks
- 406
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 120
Description
## Next.js Change
**Commit:** [`2d0ed31`](https://github.com/vercel/next.js/commit/2d0ed312066b0170410bbd0fd4e30dbcd75516b7)
**PR:** [#94025 — Include PPR routes in dynamicRoutes regardless of revalidate time](https://github.com/vercel/next.js/pull/94025)
## What changed
In `packages/next/src/build/index.ts`, the build step that emits `dynamicRoutes` into the routes-manifest changed its condition:
```diff
-if (!hasRevalidateZero && isDynamicRoute(page)) {
+const shouldEmitDynamicPrerenderRoutes =
+ !hasRevalidateZero || isRoutePPREnabled
+
+if (shouldEmitDynamicPrerenderRoutes && isDynamicRoute(page)) {
// When PPR fallbacks aren't used, we need to include it here. If
// they are enabled, then it'll already be included in the
// prerendered routes.
```
Previously, dynamic routes whose effective `revalidate` was `0` (fully dynamic) were excluded from `dynamicRoutes` in the routes-manifest. With this change, a route with `revalidate: 0` is still included if PPR is enabled for it — because PPR routes have a static shell that must be routed to regardless of the dynamic portion's revalidate.
## Impact on vinext
vinext generates its own routing tables (`routing/app-router.ts`, `routing/pages-router.ts`) rather than consuming Next.js's routes-manifest, so this is not a direct config consumption issue. The relevant question is whether vinext's route matcher correctly handles PPR routes with `revalidate: 0`:
- PPR is not fully implemented in vinext today, so the immediate impact is limited.
- When PPR support is added, the App Router route-table emission must include dynamic PPR routes even when their dynamic portion has `revalidate: 0`, otherwise the static shell will not be reachable via the dynamic-route matcher and requests will 404 (or fall through to a different handler).
Tracking item for when PPR / cacheComponents shell handling lands in vinext: ensure dynamic PPR routes are emitted into the route table regardless of `revalidate`.
Contributor guide
Assessment
This issue has not been assessed yet.