[PR #737] [MERGED] feat: implement parallelRoutesKey support in useSelectedLayoutSegment(s) #808

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

📋 Pull Request Information

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

Base: mainHead: feat/layout-persistence-foundations


📝 Commits (8)

  • 3ac653c feat: migrate LayoutSegmentContext to segmentMap for parallelRoutesKey
  • cf88a7c refactor: update all LayoutSegmentProvider consumers to segmentMap
  • 6f9660a test: add parallelRoutesKey integration tests
  • 9bb5e48 refactor: remove as cast from useSelectedLayoutSegments
  • bebb2f2 Update packages/vinext/src/shims/layout-segment-context.tsx
  • ae64510 Update packages/vinext/src/shims/navigation.ts
  • c0a594e Update packages/vinext/src/shims/layout-segment-context.tsx
  • 7689faf Merge remote-tracking branch 'origin/main' into feat/layout-persistence-foundations

📊 Changes

10 files changed (+175 additions, -51 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+2 -2)
📝 packages/vinext/src/server/app-page-boundary-render.ts (+2 -2)
📝 packages/vinext/src/server/app-page-boundary.ts (+5 -2)
📝 packages/vinext/src/shims/layout-segment-context.tsx (+12 -7)
📝 packages/vinext/src/shims/navigation.ts (+26 -23)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+12 -12)
📝 tests/app-page-boundary.test.ts (+2 -2)
📝 tests/app-router.test.ts (+31 -0)
📝 tests/fixtures/app-basic/app/dashboard/segment-display.tsx (+7 -0)
📝 tests/shims.test.ts (+76 -1)

📄 Description

Summary

Implements parallelRoutesKey support in useSelectedLayoutSegment(s) (#726). This was previously accepted but silently ignored.

Migrates LayoutSegmentContext from string[] to SegmentMap — a record with a required children key plus optional parallel route keys:

  • SegmentMap type: { readonly children: string[] } & Readonly<Record<string, string[]>>
  • useChildSegments() accepts a parallelRoutesKey parameter to index into the map
  • LayoutSegmentProvider prop changes from childSegments to segmentMap
  • All consumers updated (entry template, boundary types, boundary render)
  • Behavioral output identical for default "children" key

Test plan

  • tests/shims.test.ts — parallelRoutesKey unit + SSR tests, cross-module context test updated
  • tests/app-router.test.ts — integration tests for parallelRoutesKey with dashboard parallel routes
  • tests/entry-templates.test.ts — snapshots updated for segmentMap prop
  • tests/app-page-boundary.test.ts — boundary helper test updated for new type signature
  • pnpm run check — 0 lint/type errors

🔄 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/737 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/1/2026 **Status:** ✅ Merged **Merged:** 4/1/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `feat/layout-persistence-foundations` --- ### 📝 Commits (8) - [`3ac653c`](https://github.com/cloudflare/vinext/commit/3ac653c65d57dfecac1fd489f18e3239cbf4d3c2) feat: migrate LayoutSegmentContext to segmentMap for parallelRoutesKey - [`cf88a7c`](https://github.com/cloudflare/vinext/commit/cf88a7c8e6f1a8c1235d0da5ffb10af8ad556d3a) refactor: update all LayoutSegmentProvider consumers to segmentMap - [`6f9660a`](https://github.com/cloudflare/vinext/commit/6f9660aa6db1334ead0e96de49b48ad674dca462) test: add parallelRoutesKey integration tests - [`9bb5e48`](https://github.com/cloudflare/vinext/commit/9bb5e486414f644aa11486b4ef06c449fa043c9f) refactor: remove as cast from useSelectedLayoutSegments - [`bebb2f2`](https://github.com/cloudflare/vinext/commit/bebb2f20607983cd8ca23c9393e422555ee5dc41) Update packages/vinext/src/shims/layout-segment-context.tsx - [`ae64510`](https://github.com/cloudflare/vinext/commit/ae645102bb129424d9f471d5a6760f06d0585e3f) Update packages/vinext/src/shims/navigation.ts - [`c0a594e`](https://github.com/cloudflare/vinext/commit/c0a594e749e4a72b8341cc6f40d40ffc90a05b75) Update packages/vinext/src/shims/layout-segment-context.tsx - [`7689faf`](https://github.com/cloudflare/vinext/commit/7689faf18d89ce972eedf0adc968f5cb4489cb48) Merge remote-tracking branch 'origin/main' into feat/layout-persistence-foundations ### 📊 Changes **10 files changed** (+175 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+2 -2) 📝 `packages/vinext/src/server/app-page-boundary-render.ts` (+2 -2) 📝 `packages/vinext/src/server/app-page-boundary.ts` (+5 -2) 📝 `packages/vinext/src/shims/layout-segment-context.tsx` (+12 -7) 📝 `packages/vinext/src/shims/navigation.ts` (+26 -23) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+12 -12) 📝 `tests/app-page-boundary.test.ts` (+2 -2) 📝 `tests/app-router.test.ts` (+31 -0) 📝 `tests/fixtures/app-basic/app/dashboard/segment-display.tsx` (+7 -0) 📝 `tests/shims.test.ts` (+76 -1) </details> ### 📄 Description ## Summary Implements `parallelRoutesKey` support in `useSelectedLayoutSegment(s)` (#726). This was previously accepted but silently ignored. Migrates `LayoutSegmentContext` from `string[]` to `SegmentMap` — a record with a required `children` key plus optional parallel route keys: - `SegmentMap` type: `{ readonly children: string[] } & Readonly<Record<string, string[]>>` - `useChildSegments()` accepts a `parallelRoutesKey` parameter to index into the map - `LayoutSegmentProvider` prop changes from `childSegments` to `segmentMap` - All consumers updated (entry template, boundary types, boundary render) - Behavioral output identical for default `"children"` key ## Test plan - [x] `tests/shims.test.ts` — parallelRoutesKey unit + SSR tests, cross-module context test updated - [x] `tests/app-router.test.ts` — integration tests for parallelRoutesKey with dashboard parallel routes - [x] `tests/entry-templates.test.ts` — snapshots updated for segmentMap prop - [x] `tests/app-page-boundary.test.ts` — boundary helper test updated for new type signature - [x] `pnpm run check` — 0 lint/type errors --- <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:12 +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#808
No description provided.