[PR #458] [MERGED] fix: skip synthetic slot sub-routes without parent default fallback #586

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/458
Author: @JaredStowell
Created: 3/11/2026
Status: Merged
Merged: 3/12/2026
Merged by: @james-elicx

Base: mainHead: jstowell/fix-app-router-nested-slot-subroutes


📝 Commits (3)

  • a407051 Fix nested parallel slot routes
  • a1d4c02 Fix nested parallel slot discovery
  • 151082c Fix parallel slot routing parity

📊 Changes

2 files changed (+37 additions, -0 deletions)

View changed files

📝 packages/vinext/src/routing/app-router.ts (+1 -0)
📝 tests/routing.test.ts (+36 -0)

📄 Description

Summary

Fix App Router synthetic parallel-slot sub-route discovery when the parent segment is missing the implicit children fallback.

Before this change, discoverSlotSubRoutes() could generate a synthetic route like /inbox/profile with pagePath: null when the parent directory had no default.tsx. That route would then fail at render time with a page export error instead of being rejected during routing.

This PR now skips synthetic nested slot routes unless the parent segment has a default.tsx for the implicit children slot.

Changes

  • skip synthetic @slot sub-route generation when the parent segment has no default.tsx
  • keep valid nested slot routes working when the children fallback exists
  • add a regression test for the missing-children-default case
  • add a companion test documenting the current discoverParallelSlots() behavior when an @slot root has no own page.tsx or default.tsx

Notes

The original nested-only slot-root case remains unchanged by this PR:

app/inbox/page.tsx
app/inbox/default.tsx
app/inbox/@modal/profile/page.tsx

discoverParallelSlots() still filters out @modal when the slot root has no own page.tsx, default.tsx, or intercepting route. That behavior is now explicitly covered by test and can be addressed separately if we decide to change it.

Testing

  • pnpm test tests/routing.test.ts
  • pnpm test tests/app-router.test.ts
  • pnpm test
  • pnpm run fmt
  • pnpm run typecheck

🔄 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/458 **Author:** [@JaredStowell](https://github.com/JaredStowell) **Created:** 3/11/2026 **Status:** ✅ Merged **Merged:** 3/12/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `jstowell/fix-app-router-nested-slot-subroutes` --- ### 📝 Commits (3) - [`a407051`](https://github.com/cloudflare/vinext/commit/a4070516a92dae1dd473d6df1565005f07c8cbd3) Fix nested parallel slot routes - [`a1d4c02`](https://github.com/cloudflare/vinext/commit/a1d4c0292c69fd396c2dca16da66ebebd5c673a1) Fix nested parallel slot discovery - [`151082c`](https://github.com/cloudflare/vinext/commit/151082ca82cfafd08542f8acd148ef3618426731) Fix parallel slot routing parity ### 📊 Changes **2 files changed** (+37 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/routing/app-router.ts` (+1 -0) 📝 `tests/routing.test.ts` (+36 -0) </details> ### 📄 Description ## Summary Fix App Router synthetic parallel-slot sub-route discovery when the parent segment is missing the implicit `children` fallback. Before this change, `discoverSlotSubRoutes()` could generate a synthetic route like `/inbox/profile` with `pagePath: null` when the parent directory had no `default.tsx`. That route would then fail at render time with a page export error instead of being rejected during routing. This PR now skips synthetic nested slot routes unless the parent segment has a `default.tsx` for the implicit `children` slot. ## Changes - skip synthetic `@slot` sub-route generation when the parent segment has no `default.tsx` - keep valid nested slot routes working when the `children` fallback exists - add a regression test for the missing-`children`-default case - add a companion test documenting the current `discoverParallelSlots()` behavior when an `@slot` root has no own `page.tsx` or `default.tsx` ## Notes The original nested-only slot-root case remains unchanged by this PR: ```txt app/inbox/page.tsx app/inbox/default.tsx app/inbox/@modal/profile/page.tsx ``` `discoverParallelSlots()` still filters out `@modal` when the slot root has no own `page.tsx`, `default.tsx`, or intercepting route. That behavior is now explicitly covered by test and can be addressed separately if we decide to change it. ## Testing - `pnpm test tests/routing.test.ts` - `pnpm test tests/app-router.test.ts` - `pnpm test` - `pnpm run fmt` - `pnpm run typecheck` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:55 +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#586
No description provided.