mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 00:09:23 +02:00
[PR #1039] [MERGED] fix(routing): mirror inherited parallel slots to descendant sub-pages #1042
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#1042
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/1039
Author: @james-elicx
Created: 5/3/2026
Status: ✅ Merged
Merged: 5/3/2026
Merged by: @james-elicx
Base:
main← Head:claude/cranky-heyrovsky-5f9148📝 Commits (3)
04cf20ffix(routing): mirror inherited parallel slots to descendant sub-pages7c5e732fix(routing): extract slot-specific params for inherited mirrors761c07cfix(routing): address bonk review on inherited parallel slot mirror📊 Changes
15 files changed (+473 additions, -21 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-manifest.ts(+2 -0)📝
packages/vinext/src/routing/app-route-graph.ts(+173 -10)📝
packages/vinext/src/server/app-page-element-builder.ts(+69 -10)📝
packages/vinext/src/server/app-page-route-wiring.tsx(+15 -1)📝
tests/app-route-graph.test.ts(+126 -0)➕
tests/e2e/app-router/inherited-parallel-slots.spec.ts(+34 -0)➕
tests/fixtures/app-basic/app/inherited-slot/@breadcrumbs/[...path]/page.tsx(+8 -0)➕
tests/fixtures/app-basic/app/inherited-slot/@breadcrumbs/about/page.tsx(+3 -0)➕
tests/fixtures/app-basic/app/inherited-slot/@breadcrumbs/default.tsx(+3 -0)➕
tests/fixtures/app-basic/app/inherited-slot/@breadcrumbs/distinct/[name]/page.tsx(+8 -0)➕
tests/fixtures/app-basic/app/inherited-slot/[...path]/page.tsx(+8 -0)➕
tests/fixtures/app-basic/app/inherited-slot/about/page.tsx(+3 -0)➕
tests/fixtures/app-basic/app/inherited-slot/distinct/[id]/page.tsx(+4 -0)➕
tests/fixtures/app-basic/app/inherited-slot/layout.tsx(+14 -0)➕
tests/fixtures/app-basic/app/inherited-slot/page.tsx(+3 -0)📄 Description
Summary
Fixes two related bugs in inherited parallel-slot resolution where slots silently rendered
default.tsxinstead of their mirrored sub-page.1. Inherited slots never mirrored sub-pages
discoverInheritedParallelSlotswas hard-codingpagePath: nullfor any ancestor slot, so a slot defined at the layout level only ever rendereddefault.tsx— even when a clear mirror existed. With the fix, each ancestor's segment index is tracked indirsToCheckand the mirror is looked up through three tiers, each more permissive than the last:(marketing)/about↔@breadcrumbs/about.Falls back to
default.tsxwhen no mirror matches.2. Slot params used the route's pattern, not the slot's
When the slot's mirror declares dynamic markers under different names than the route (e.g. slot
@breadcrumbs/distinct/[name]for routedistinct/[id]), the runtime was passing the route'smatchedParamsthrough unchanged — so the slot page received{id}instead of{name}and rendered with empty values.Three changes plumb slot-specific params:
ParallelSlotcarriesslotPatternPartsandslotParamNames(full URL pattern + ordered param names), serialized through the manifest.buildPageElementsextracts a per-requestslotOverrides[key].paramsby matching the request URL againstslotPatternPartswhenever a slot's params aren't a subset of the route's.AppPageSlotOverride.pageModulebecomes optional so a params-only override doesn't have to swap the slot's page.Tests
Unit (
tests/app-route-graph.test.ts):(marketing)/about, slot has plainabout)E2E (
tests/e2e/app-router/inherited-parallel-slots.spec.ts) with a fixture underapp/inherited-slot/:/inherited-slot/about/inherited-slot/products/42(route and slot both use[...path]so params share names)/inherited-slot/inherited-slot/distinct/foo(route[id], slot[name]); the page rendersid:fooand the slot rendersname:foo. Verified to fail before the runtime fix (slot rendered with emptyname).Test plan
pnpm checkpassespnpm test:unit(3480 tests)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.