Add per-slot error attribution for instant validation using slot markers and config depth preference#91610
Open
Add per-slot error attribution for instant validation using slot markers and config depth preference#91610
Conversation
…ers and config depth preference When a validation boundary spans multiple parallel slots, errors were previously attributed to whichever unstable_instant config was found first during tree iteration — which varied between turbopack and webpack. This made the "Caused by: Instant Validation" source non-deterministic and sometimes pointed to the wrong slot's config. This adds a SlotMarker client component that wraps each slot's content at fork points (where parallel routes > 1). The marker's dynamically-named inner function appears in the SSR component stack, allowing resolveInstantStack to identify which slot an error belongs to and look up that slot's config. When a slot has no config, it falls back to slotStacks[0] (the root config). The root config is now selected by config depth preference rather than first-found. configDepth tracks how many URL-consuming segments deep a config was found, with deeper configs preferred as more specific. At equal depth, the children slot is preferred over named slots. This ensures deterministic attribution regardless of bundler iteration order. Key changes: - SlotMarker component in boundary-impl.tsx takes a name prop and lazily creates named inner functions cached by name - slotStacks array replaces the singleton createInstantStack on InstantValidationState (index 0 = root config, 1+ = per-slot) - configDepth on TreeResult only counts URL-consuming segments — synthetic segments like (__SLOT__), __PAGE__, and route groups don't contribute - resolveInstantStack parses component stacks for slot markers and maps to the correct config - wrapSlotsWithMarkers called at every fork in both buildSharedTreeSeedData and buildNewTreeSeedData
Collaborator
Tests Passed |
eps1lon
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a validation boundary spans multiple parallel slots, errors were previously attributed to whichever unstable_instant config was found first during tree iteration — which varied between turbopack and webpack. This made the "Caused by: Instant Validation" source non-deterministic and sometimes pointed to the wrong slot's config.
This adds a SlotMarker client component that wraps each slot's content at fork points (where parallel routes > 1). The marker's dynamically-named inner function appears in the SSR component stack, allowing resolveInstantStack to identify which slot an error belongs to and look up that slot's config. When a slot has no config, it falls back to slotStacks[0] (the root config).
The root config is now selected by config depth preference rather than first-found. configDepth tracks how many URL-consuming segments deep a config was found, with deeper configs preferred as more specific. At equal depth, the children slot is preferred over named slots. This ensures deterministic attribution regardless of bundler iteration order.
Key changes: