[PR #815] [CLOSED] fix: clear stale parallel slots on traversal in mergeElements #865

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/815
Author: @NathanDrake2406
Created: 4/10/2026
Status: Closed

Base: mainHead: fix/traversal-stale-parallel-slots


📝 Commits (1)

  • 6e18a7c fix: clear stale parallel slots on traversal in mergeElements

📊 Changes

2 files changed (+33 additions, -0 deletions)

View changed files

📝 packages/vinext/src/shims/slot.tsx (+11 -0)
📝 tests/slot.test.ts (+22 -0)

📄 Description

Summary

  • mergeElements now deletes slot keys from prev that are absent from next, fixing stale parallel slots persisting through browser back/forward
  • Adds unit test verifying the new behavior alongside existing UNMATCHED_SLOT preservation tests

Context

When navigating back from an intercepted route (e.g., /feed -> photo modal -> back), the RSC response for /feed omits the @modal slot entirely. The spread { ...prev, ...next } silently carried the stale modal forward. Now, a slot absent from next is treated as "not in the route tree" and cleared.

This is distinct from the existing UNMATCHED_SLOT case, where the server acknowledges the slot but no route matched it (preserved for soft navigation continuity).

Closes #814

Test plan

  • Unit test: mergeElements clears stale slots absent from next response
  • Existing mergeElements tests still pass (UNMATCHED_SLOT preservation, shallow merge)
  • E2E test for back/forward on intercepted routes (depends on #753 for test infrastructure, tracked separately)

🔄 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/815 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/10/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/traversal-stale-parallel-slots` --- ### 📝 Commits (1) - [`6e18a7c`](https://github.com/cloudflare/vinext/commit/6e18a7ca1ba9cf2dcc2a9b37ed5000b2fc426e71) fix: clear stale parallel slots on traversal in mergeElements ### 📊 Changes **2 files changed** (+33 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/shims/slot.tsx` (+11 -0) 📝 `tests/slot.test.ts` (+22 -0) </details> ### 📄 Description ## Summary - `mergeElements` now deletes slot keys from `prev` that are absent from `next`, fixing stale parallel slots persisting through browser back/forward - Adds unit test verifying the new behavior alongside existing UNMATCHED_SLOT preservation tests ## Context When navigating back from an intercepted route (e.g., `/feed` -> photo modal -> back), the RSC response for `/feed` omits the `@modal` slot entirely. The spread `{ ...prev, ...next }` silently carried the stale modal forward. Now, a slot absent from `next` is treated as "not in the route tree" and cleared. This is distinct from the existing `UNMATCHED_SLOT` case, where the server acknowledges the slot but no route matched it (preserved for soft navigation continuity). Closes #814 ## Test plan - [x] Unit test: `mergeElements clears stale slots absent from next response` - [x] Existing `mergeElements` tests still pass (UNMATCHED_SLOT preservation, shallow merge) - [ ] E2E test for back/forward on intercepted routes (depends on #753 for test infrastructure, tracked separately) --- <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:32 +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#865
No description provided.