[PR #721] [MERGED] test: regression tests for inherited intercepting route slot deduplication #798

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

📋 Pull Request Information

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

Base: mainHead: fix/intercepting-routes


📝 Commits (7)

  • 3fa9df7 fix: allow inherited intercepting routes to share target patterns
  • 60b3796 fix: validate intercepting route target consistency per page
  • 3b05f17 refactor: simplify intercept target pattern collection by using Set for deduplication
  • 97882cb merge: sync with main and address bonk review comments
  • e988757 fixup: use main's inline Set dedup, remove helper export, restore .gitignore
  • 90dcd9e fix(test): pass explicit out dirs and appDir to buildApp to fix UNRESOLVED_IMPORT in RSC build
  • 9479f3d chore: restore .gitignore to match main

📊 Changes

10 files changed (+439 additions, -1 deletions)

View changed files

📝 examples/app-router-playground/app/_internal/_data.ts (+6 -0)
examples/app-router-playground/app/intercepting-routes/@modal/(.)photo/[id]/page.tsx (+73 -0)
examples/app-router-playground/app/intercepting-routes/@modal/default.tsx (+3 -0)
examples/app-router-playground/app/intercepting-routes/layout.tsx (+44 -0)
examples/app-router-playground/app/intercepting-routes/page.tsx (+33 -0)
examples/app-router-playground/app/intercepting-routes/photo/[id]/page.tsx (+57 -0)
examples/app-router-playground/app/intercepting-routes/readme.mdx (+7 -0)
📝 packages/vinext/src/routing/app-router.ts (+5 -1)
tests/intercepting-routes-build.test.ts (+157 -0)
📝 tests/routing.test.ts (+54 -0)

📄 Description

Summary

The fix for this bug (inherited parallel slots causing the same intercepting page to be counted multiple times during validation) has already been merged into main. This PR retains the regression tests and the intercepting-routes playground example so the behavior stays covered going forward.

What's included

  • tests/intercepting-routes-build.test.ts — production build regression test: verifies a route structure with an inherited @modal slot and an intercepting (.)photo/[id] route builds successfully
  • tests/routing.test.ts — unit regression test: verifies that inherited intercepting slots sharing the same target pattern are correctly allowed (not rejected as duplicates)
  • examples/app-router-playground/app/intercepting-routes/ — playground demo showing the intercepting routes pattern with a modal slot

Background

When a parallel slot is inherited by child routes, the same intercepting page can appear on multiple discovered routes. The old validation flattened all intercepted target patterns and treated repeated entries from inherited slots as separate route definitions, incorrectly throwing:

You cannot have two routes that resolve to the same path

The fix (de-duplicating by target pattern before validation) landed in main separately. These tests guard against regressions.


🔄 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/721 **Author:** [@Debbl](https://github.com/Debbl) **Created:** 3/30/2026 **Status:** ✅ Merged **Merged:** 4/5/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/intercepting-routes` --- ### 📝 Commits (7) - [`3fa9df7`](https://github.com/cloudflare/vinext/commit/3fa9df7c2cd2cef238c079224c056e945d8125c0) fix: allow inherited intercepting routes to share target patterns - [`60b3796`](https://github.com/cloudflare/vinext/commit/60b37960fcd45cc3fa365ebf6a3be9fc367fa24c) fix: validate intercepting route target consistency per page - [`3b05f17`](https://github.com/cloudflare/vinext/commit/3b05f17aae6e94b83b326d1f9b1edb0ce1abc23f) refactor: simplify intercept target pattern collection by using Set for deduplication - [`97882cb`](https://github.com/cloudflare/vinext/commit/97882cb9c9e13202a798c91f475f5b5f1b903512) merge: sync with main and address bonk review comments - [`e988757`](https://github.com/cloudflare/vinext/commit/e988757be6f7441509aacd38129ed887b4be5112) fixup: use main's inline Set dedup, remove helper export, restore .gitignore - [`90dcd9e`](https://github.com/cloudflare/vinext/commit/90dcd9eccba968a30cd38835ed8508603f84c619) fix(test): pass explicit out dirs and appDir to buildApp to fix UNRESOLVED_IMPORT in RSC build - [`9479f3d`](https://github.com/cloudflare/vinext/commit/9479f3dff0d14944b4470f52cf2463cc589f6403) chore: restore .gitignore to match main ### 📊 Changes **10 files changed** (+439 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `examples/app-router-playground/app/_internal/_data.ts` (+6 -0) ➕ `examples/app-router-playground/app/intercepting-routes/@modal/(.)photo/[id]/page.tsx` (+73 -0) ➕ `examples/app-router-playground/app/intercepting-routes/@modal/default.tsx` (+3 -0) ➕ `examples/app-router-playground/app/intercepting-routes/layout.tsx` (+44 -0) ➕ `examples/app-router-playground/app/intercepting-routes/page.tsx` (+33 -0) ➕ `examples/app-router-playground/app/intercepting-routes/photo/[id]/page.tsx` (+57 -0) ➕ `examples/app-router-playground/app/intercepting-routes/readme.mdx` (+7 -0) 📝 `packages/vinext/src/routing/app-router.ts` (+5 -1) ➕ `tests/intercepting-routes-build.test.ts` (+157 -0) 📝 `tests/routing.test.ts` (+54 -0) </details> ### 📄 Description ## Summary The fix for this bug (inherited parallel slots causing the same intercepting page to be counted multiple times during validation) has already been merged into main. This PR retains the regression tests and the `intercepting-routes` playground example so the behavior stays covered going forward. ## What's included - `tests/intercepting-routes-build.test.ts` — production build regression test: verifies a route structure with an inherited `@modal` slot and an intercepting `(.)photo/[id]` route builds successfully - `tests/routing.test.ts` — unit regression test: verifies that inherited intercepting slots sharing the same target pattern are correctly allowed (not rejected as duplicates) - `examples/app-router-playground/app/intercepting-routes/` — playground demo showing the intercepting routes pattern with a modal slot ## Background When a parallel slot is inherited by child routes, the same intercepting page can appear on multiple discovered routes. The old validation flattened all intercepted target patterns and treated repeated entries from inherited slots as separate route definitions, incorrectly throwing: `You cannot have two routes that resolve to the same path` The fix (de-duplicating by target pattern before validation) landed in main separately. These tests guard against regressions. --- <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:09 +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#798
No description provided.