next.js
0ca967b8 - Add group depth tracking to instant validation boundary discovery (#91208)

Commit
5 days ago
Add group depth tracking to instant validation boundary discovery (#91208) The depth-based instant validation previously only iterated URL-consuming segments as potential shared/new boundaries. Route groups between URL segments were invisible — when a route group layout with Suspense was shared in a client navigation, its Suspense appeared to cover blocking code in the validation render even though it wouldn't in reality. This adds a second dimension to the validation iteration: group depth. At each URL depth, we now also step through route group boundaries. A new `discoverValidationDepths` function walks the LoaderTree and returns an array where each entry represents the max group depth at that URL depth. The validation loop iterates from deepest group depth to shallowest within each URL depth, stopping on the first error. Key design decisions: - URL depth and group depth counters are advanced before the boundary check, making the boundary condition a simple `nextUrlDepth > depth && currentGroupDepth >= groupDepth` - The synthetic `(slot)` segment that Next.js inserts for parallel slots is excluded from group depth counting since it doesn't represent a real navigation boundary - Group depths are discovered from the LoaderTree rather than the URL pathname, making the tree the source of truth for validation bounds
Author
Parents
Loading