mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #499] [MERGED] fix: intercept routes (..) climb visible route segments, not filesystem dirs #621
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#621
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/499
Author: @NathanDrake2406
Created: 3/12/2026
Status: ✅ Merged
Merged: 3/12/2026
Merged by: @james-elicx
Base:
main← Head:fix/intercept-route-segment-climbing📝 Commits (1)
1dd9ac9fix: intercept routes (..) climb visible route segments, not filesystem dirs📊 Changes
2 files changed (+131 additions, -29 deletions)
View changed files
📝
packages/vinext/src/routing/app-router.ts(+41 -29)📝
tests/routing.test.ts(+90 -0)📄 Description
Summary
computeInterceptTarget()to climb by visible route segments instead of filesystem directories. Previously it usedpath.dirname()which counted route groups like(marketing)as levels, causing(..)and(..)(..)to resolve to the wrong target when route groups sit between visible segments.isInvisibleSegment()helper, replacing three duplicated inline checks acrosscomputeInterceptTarget,convertSegmentsToRouteParts, andhasRemainingVisibleSegments.Example of the bug
Visible route path:
/a/b.(..)(..)should climb 2 visible segments → root → intercept/target.Before:
path.dirname(path.dirname("app/a/(group)/b"))="app/a"→ produced/a/target(wrong — climbedbthen(group), wasting a level on the invisible route group).After: Walks backward through
["a", "(group)", "b"], counting only visible segments (b→a), correctly resolving to/target.Test plan
(..)and(..)(..)with route groups between segments🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.