[PR #872] [MERGED] Render intercept route layouts inside App Router slots #909

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/872
Author: @NathanDrake2406
Created: 4/22/2026
Status: Merged
Merged: 4/23/2026
Merged by: @james-elicx

Base: mainHead: nathan/intercept-layout-chain


📝 Commits (3)

  • 1577977 Render intercept route layouts inside App Router slots
  • 4ce70b6 Avoid repeated intercept layout scans and slot param wrapping
  • bf70a02 Clarify intercept layout plumbing and cover nested layout chains

📊 Changes

7 files changed (+272 additions, -12 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+10 -2)
📝 packages/vinext/src/routing/app-router.ts (+10 -0)
📝 packages/vinext/src/server/app-page-route-wiring.tsx (+18 -4)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+30 -6)
📝 tests/app-page-route-wiring.test.ts (+73 -0)
📝 tests/app-router.test.ts (+52 -0)
📝 tests/routing.test.ts (+79 -0)

📄 Description

What this changes

App Router intercepting routes now keep and render layout.tsx files that live inside the intercepting route tree instead of rendering the intercepted page bare inside the slot.

Why

Current vinext behavior drops those intercept-local layouts during discovery, so a modal intercept can match the right page but still miss required wrappers that Next.js applies. That breaks cases like @modal/(.)explicit-layout/layout.tsx with a nested intercepted page.

Approach

Collect intercept layout paths during App Router discovery, carry them through generated RSC entry serialization, and apply the resulting layout modules around the intercepted slot override before the slot layout renders.

This stays within the existing intercept pipeline rather than adding a separate render path.

Validation

  • Added routing coverage for intercept layout chain discovery
  • Added route-wiring coverage for slot layout -> intercept layouts -> page render order
  • Added RSC entry codegen coverage for forwarding intercept layout modules
  • Ran vp test run /Users/nathan/Projects/vinext/tests/routing.test.ts /Users/nathan/Projects/vinext/tests/app-page-route-wiring.test.ts /Users/nathan/Projects/vinext/tests/app-router.test.ts

Risks / follow-ups

The generated entry now carries one more intercept field through the serialization path. The added codegen test covers that contract directly.


🔄 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/872 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/22/2026 **Status:** ✅ Merged **Merged:** 4/23/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `nathan/intercept-layout-chain` --- ### 📝 Commits (3) - [`1577977`](https://github.com/cloudflare/vinext/commit/15779773e523de8153503c9179aca7741f08a859) Render intercept route layouts inside App Router slots - [`4ce70b6`](https://github.com/cloudflare/vinext/commit/4ce70b6c8669ec7bc2a19487dde61c1fc43ee9db) Avoid repeated intercept layout scans and slot param wrapping - [`bf70a02`](https://github.com/cloudflare/vinext/commit/bf70a02178a0dbd6560a6c97007858100b43db66) Clarify intercept layout plumbing and cover nested layout chains ### 📊 Changes **7 files changed** (+272 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+10 -2) 📝 `packages/vinext/src/routing/app-router.ts` (+10 -0) 📝 `packages/vinext/src/server/app-page-route-wiring.tsx` (+18 -4) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+30 -6) 📝 `tests/app-page-route-wiring.test.ts` (+73 -0) 📝 `tests/app-router.test.ts` (+52 -0) 📝 `tests/routing.test.ts` (+79 -0) </details> ### 📄 Description ## What this changes App Router intercepting routes now keep and render `layout.tsx` files that live inside the intercepting route tree instead of rendering the intercepted page bare inside the slot. ## Why Current vinext behavior drops those intercept-local layouts during discovery, so a modal intercept can match the right page but still miss required wrappers that Next.js applies. That breaks cases like `@modal/(.)explicit-layout/layout.tsx` with a nested intercepted page. ## Approach Collect intercept layout paths during App Router discovery, carry them through generated RSC entry serialization, and apply the resulting layout modules around the intercepted slot override before the slot layout renders. This stays within the existing intercept pipeline rather than adding a separate render path. ## Validation - Added routing coverage for intercept layout chain discovery - Added route-wiring coverage for slot layout -> intercept layouts -> page render order - Added RSC entry codegen coverage for forwarding intercept layout modules - Ran `vp test run /Users/nathan/Projects/vinext/tests/routing.test.ts /Users/nathan/Projects/vinext/tests/app-page-route-wiring.test.ts /Users/nathan/Projects/vinext/tests/app-router.test.ts` ## Risks / follow-ups The generated entry now carries one more intercept field through the serialization path. The added codegen test covers that contract directly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:10:47 +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#909
No description provided.