Add snapshot test for parallel slot flight router state#91148
Draft
Add snapshot test for parallel slot flight router state#91148
Conversation
Tests the flight router state tree for parallel routes with @slot, capturing the discrepancy between turbopack and webpack: - Turbopack uses "(slot)" segment for direct @slot/page.tsx - Webpack uses "__PAGE__" segment for direct @slot/page.tsx - Both agree on "(slot)" for nested @slot/nested/page.tsx
Collaborator
Failing test suitesCommit: ae84042 | About building and testing Next.js
Expand output● parallel-routes-flight-router-state › should have correct flight router state for / (direct slot page) ● parallel-routes-flight-router-state › should have correct flight router state for /nested (nested slot page)
Expand output● Telemetry CLI › production mode › emits event when swc fails to load |
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.
What?
Adds an e2e snapshot test that captures the flight router state tree produced for parallel routes using
@slot.Why?
There is a discrepancy between Turbopack and Webpack in how they represent parallel slot segments in the flight router state:
@slot/page.tsx(direct page): Turbopack produces"(slot)"as the segment, while Webpack produces"__PAGE__".@slot/nested/page.tsx(nested page): Both bundlers agree on"(slot)".Root cause:
next-app-loader/index.ts): When@slot/page.tsxexists directly (line 752-757), it matches as[PAGE_SEGMENT]which gets normalized to__PAGE__. Only nested parallel routes triggerPARALLEL_VIRTUAL_SEGMENT→(slot).app_structure.rs): Unconditionally setstree.segment = "(slot)"for any@paralleldirectory (line 1264-1268), regardless of nesting.This test captures the current Turbopack behavior in inline snapshots so the discrepancy is visible and trackable.
How?
New test at
test/e2e/app-dir/parallel-routes-flight-router-state/:Fixture:
Tests:
/and/nested__next_fscript tags)Current results:
/route snapshot differs (__PAGE__vs(slot))