mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #341] [MERGED] fix: rewrite useSelectedLayoutSegment(s) to use context-based child segments #491
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#491
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/341
Author: @NathanDrake2406
Created: 3/8/2026
Status: ✅ Merged
Merged: 3/8/2026
Merged by: @james-elicx
Base:
main← Head:fix/use-selected-layout-segment📝 Commits (1)
ca0ec6afix: rewrite useSelectedLayoutSegment(s) to use context-based child segments📊 Changes
13 files changed (+383 additions, -137 deletions)
View changed files
📝
packages/vinext/src/routing/app-router.ts(+28 -49)📝
packages/vinext/src/server/app-dev-server.ts(+65 -21)📝
packages/vinext/src/shims/layout-segment-context.tsx(+7 -6)📝
packages/vinext/src/shims/navigation.ts(+29 -29)📝
packages/vinext/src/shims/next-shims.d.ts(+1 -1)📝
tests/app-router.test.ts(+10 -5)➕
tests/fixtures/app-basic/app/nextjs-compat/hooks-segments/first/[dynamic]/(group)/second/[...catchall]/page.tsx(+18 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/hooks-segments/first/[dynamic]/page.tsx(+18 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/hooks-segments/first/layout.tsx(+23 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/hooks-segments/first/page.tsx(+3 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/hooks-segments/layout.tsx(+19 -0)➕
tests/nextjs-compat/layout-segments.test.ts(+149 -0)📝
tests/shims.test.ts(+13 -26)📄 Description
Summary
useSelectedLayoutSegment(s), fixing incorrect behavior when route groups are present in the App Router treeLayoutSegmentProvidervalues stay consistent withbuildPageElement()during error page renderingrouteSegmentsfor parallel slot sub-routesTest plan
tests/shims.test.ts,tests/app-router.test.ts)tests/nextjs-compat/layout-segments.test.ts) with fixture pages covering:🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.