[PR #545] [MERGED] fix: use closest ancestor parallel slot instead of farthest #661

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/545
Author: @NathanDrake2406
Created: 3/15/2026
Status: Merged
Merged: 3/15/2026
Merged by: @james-elicx

Base: mainHead: fix/parallel-slot-priority


📝 Commits (1)

  • 22d3c03 fix: use closest ancestor parallel slot instead of farthest

📊 Changes

2 files changed (+39 additions, -4 deletions)

View changed files

📝 packages/vinext/src/routing/app-router.ts (+3 -4)
📝 tests/routing.test.ts (+36 -0)

📄 Description

Summary

  • discoverInheritedParallelSlots iterated root-to-leaf but used if (!slotMap.has(slot.name)) which made the farthest ancestor's slot win instead of the closest
  • For example, with @sidebar at both app/ and app/dashboard/, the route /dashboard/settings would incorrectly get the root-level sidebar
  • Removed the has() guard so slotMap.set() is called unconditionally for inherited slots — since iteration goes root-to-leaf, later (closer) ancestors naturally overwrite earlier (farther) ones
  • One-line fix, consistent with the isOwnDir branch which already used unconditional set()

Test plan

  • New test with fixture: same @sidebar at root and dashboard levels, verifies /dashboard/settings gets the dashboard-level slot
  • All 128 routing tests pass (91 routing + 37 route-sorting)
  • Typecheck and lint clean

🔄 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/545 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 3/15/2026 **Status:** ✅ Merged **Merged:** 3/15/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/parallel-slot-priority` --- ### 📝 Commits (1) - [`22d3c03`](https://github.com/cloudflare/vinext/commit/22d3c03a1c2c5abd0285fd4a6a69af5577645351) fix: use closest ancestor parallel slot instead of farthest ### 📊 Changes **2 files changed** (+39 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/routing/app-router.ts` (+3 -4) 📝 `tests/routing.test.ts` (+36 -0) </details> ### 📄 Description ## Summary - `discoverInheritedParallelSlots` iterated root-to-leaf but used `if (!slotMap.has(slot.name))` which made the farthest ancestor's slot win instead of the closest - For example, with `@sidebar` at both `app/` and `app/dashboard/`, the route `/dashboard/settings` would incorrectly get the root-level sidebar - Removed the `has()` guard so `slotMap.set()` is called unconditionally for inherited slots — since iteration goes root-to-leaf, later (closer) ancestors naturally overwrite earlier (farther) ones - One-line fix, consistent with the `isOwnDir` branch which already used unconditional `set()` ## Test plan - [x] New test with fixture: same `@sidebar` at root and dashboard levels, verifies `/dashboard/settings` gets the dashboard-level slot - [x] All 128 routing tests pass (91 routing + 37 route-sorting) - [x] Typecheck and lint clean --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:24 +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#661
No description provided.