[PR #993] [MERGED] fix(app): apply layout segment config to pages #1006

Closed
opened 2026-05-06 13:11:31 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/993
Author: @NathanDrake2406
Created: 4/30/2026
Status: Merged
Merged: 5/3/2026
Merged by: @james-elicx

Base: mainHead: nathan/layout-segment-config


📝 Commits (2)

  • 8a4a177 fix(app): apply layout segment config to pages
  • 62b7fda fix(app): address segment config review nits

📊 Changes

29 files changed (+1048 additions, -34 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+38 -5)
📝 packages/vinext/src/server/app-page-dispatch.ts (+11 -1)
📝 packages/vinext/src/server/app-page-params.ts (+2 -2)
📝 packages/vinext/src/server/app-page-request.ts (+113 -11)
packages/vinext/src/server/app-segment-config.ts (+174 -0)
📝 packages/vinext/src/server/app-server-action-execution.ts (+5 -0)
📝 packages/vinext/src/shims/fetch-cache.ts (+127 -14)
📝 packages/vinext/src/shims/unified-request-context.ts (+1 -0)
📝 tests/app-page-request.test.ts (+65 -0)
📝 tests/app-router.test.ts (+64 -0)
tests/app-segment-config.test.ts (+190 -0)
📝 tests/fetch-cache.test.ts (+151 -0)
📝 tests/fixtures/app-basic/app/feed/page.tsx (+3 -1)
tests/fixtures/app-basic/app/layout-segment-config/dynamic-error-fetch/page.tsx (+6 -0)
tests/fixtures/app-basic/app/layout-segment-config/dynamic-error/[id]/layout.tsx (+5 -0)
tests/fixtures/app-basic/app/layout-segment-config/dynamic-error/[id]/page.tsx (+8 -0)
tests/fixtures/app-basic/app/layout-segment-config/dynamic/[id]/layout.tsx (+5 -0)
tests/fixtures/app-basic/app/layout-segment-config/dynamic/[id]/page.tsx (+8 -0)
tests/fixtures/app-basic/app/layout-segment-config/force-dynamic/layout.tsx (+5 -0)
tests/fixtures/app-basic/app/layout-segment-config/force-dynamic/page.tsx (+3 -0)

...and 9 more files

📄 Description

Summary

  • resolve App page segment config from the full matched layout -> page module chain instead of only route.page
  • apply layout-level dynamic, revalidate, dynamicParams, and fetchCache to App page request handling
  • keep codegen thin: the generated RSC entry lists route modules and delegates config reduction to server/app-segment-config

Next.js compatibility evidence

Tests

  • vp test run tests/app-segment-config.test.ts tests/fetch-cache.test.ts tests/entry-templates.test.ts
  • vp test run tests/app-router.test.ts -t "dynamicParams = false exported from a layout|revalidate exported from a layout|force-dynamic' exported from a layout"
  • vp check packages/vinext/src/server/app-segment-config.ts packages/vinext/src/shims/fetch-cache.ts packages/vinext/src/shims/unified-request-context.ts packages/vinext/src/entries/app-rsc-entry.ts tests/app-segment-config.test.ts tests/fetch-cache.test.ts tests/app-router.test.ts

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/993 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/30/2026 **Status:** ✅ Merged **Merged:** 5/3/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `nathan/layout-segment-config` --- ### 📝 Commits (2) - [`8a4a177`](https://github.com/cloudflare/vinext/commit/8a4a1771145da0ae9b32df8c834dd26cde193533) fix(app): apply layout segment config to pages - [`62b7fda`](https://github.com/cloudflare/vinext/commit/62b7fda665164b1e630ae7d8f44f8a899cc1f842) fix(app): address segment config review nits ### 📊 Changes **29 files changed** (+1048 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+38 -5) 📝 `packages/vinext/src/server/app-page-dispatch.ts` (+11 -1) 📝 `packages/vinext/src/server/app-page-params.ts` (+2 -2) 📝 `packages/vinext/src/server/app-page-request.ts` (+113 -11) ➕ `packages/vinext/src/server/app-segment-config.ts` (+174 -0) 📝 `packages/vinext/src/server/app-server-action-execution.ts` (+5 -0) 📝 `packages/vinext/src/shims/fetch-cache.ts` (+127 -14) 📝 `packages/vinext/src/shims/unified-request-context.ts` (+1 -0) 📝 `tests/app-page-request.test.ts` (+65 -0) 📝 `tests/app-router.test.ts` (+64 -0) ➕ `tests/app-segment-config.test.ts` (+190 -0) 📝 `tests/fetch-cache.test.ts` (+151 -0) 📝 `tests/fixtures/app-basic/app/feed/page.tsx` (+3 -1) ➕ `tests/fixtures/app-basic/app/layout-segment-config/dynamic-error-fetch/page.tsx` (+6 -0) ➕ `tests/fixtures/app-basic/app/layout-segment-config/dynamic-error/[id]/layout.tsx` (+5 -0) ➕ `tests/fixtures/app-basic/app/layout-segment-config/dynamic-error/[id]/page.tsx` (+8 -0) ➕ `tests/fixtures/app-basic/app/layout-segment-config/dynamic/[id]/layout.tsx` (+5 -0) ➕ `tests/fixtures/app-basic/app/layout-segment-config/dynamic/[id]/page.tsx` (+8 -0) ➕ `tests/fixtures/app-basic/app/layout-segment-config/force-dynamic/layout.tsx` (+5 -0) ➕ `tests/fixtures/app-basic/app/layout-segment-config/force-dynamic/page.tsx` (+3 -0) _...and 9 more files_ </details> ### 📄 Description ## Summary - resolve App page segment config from the full matched layout -> page module chain instead of only `route.page` - apply layout-level `dynamic`, `revalidate`, `dynamicParams`, and `fetchCache` to App page request handling - keep codegen thin: the generated RSC entry lists route modules and delegates config reduction to `server/app-segment-config` ## Next.js compatibility evidence - Next.js collects App page segments from the route loader tree before reducing config: https://github.com/vercel/next.js/blob/canary/packages/next/src/build/segment-config/app/app-segments.ts#L86-L123 - Next.js reduces route config across collected segments, including `dynamic`, `fetchCache`, and shortest numeric `revalidate`: https://github.com/vercel/next.js/blob/canary/packages/next/src/build/utils.ts#L1001-L1041 - Next.js treats `dynamicParams = false` as effective if any generated segment disables dynamic params: https://github.com/vercel/next.js/blob/canary/packages/next/src/build/static-paths/app.ts#L907-L959 ## Tests - `vp test run tests/app-segment-config.test.ts tests/fetch-cache.test.ts tests/entry-templates.test.ts` - `vp test run tests/app-router.test.ts -t "dynamicParams = false exported from a layout|revalidate exported from a layout|force-dynamic' exported from a layout"` - `vp check packages/vinext/src/server/app-segment-config.ts packages/vinext/src/shims/fetch-cache.ts packages/vinext/src/shims/unified-request-context.ts packages/vinext/src/entries/app-rsc-entry.ts tests/app-segment-config.test.ts tests/fetch-cache.test.ts tests/app-router.test.ts` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:31 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#1006
No description provided.