Fix unexpected query parameters in adapter deployments - #98584
Draft
unstubbable wants to merge 1 commit into
Draft
Fix unexpected query parameters in adapter deployments#98584unstubbable wants to merge 1 commit into
unstubbable wants to merge 1 commit into
Conversation
Contributor
Tests PassedCommit: 636f5f7 |
The Vercel adapter enables `passQuery: true`, which forwards named route captures to prerender functions as query parameters instead of using the legacy route-matches header. When a request bypasses prerendered output, this also exposes internal path-building captures through application `searchParams`. With `experimental.collapseAdapterRoutes` disabled, RSC renders can receive `rscSuffix=.rsc`. With the flag enabled, document and Server Action renders can also receive `rscSuffix=`, and collapsed fallback shells can expose values such as `shellPrefix=en`. These additions can overwrite user query parameters and cause unnecessary navigation retries. When using an adapter, we now emit unnamed captures for these path-only values. For example, `(?<shellPrefix>de|en)` and its destination reference `$shellPrefix` become `(de|en)` and `$1` when no locale capture precedes the group. Likewise, `(?<rscSuffix>...)` and `$rscSuffix` become `(...)` and a positional reference such as `$2` when one capture precedes the suffix. The generator accounts for parameter and locale captures and escapes literal base paths. Destination substitution runs once, preserving captured text and correctly distinguishing references such as `$1` and `$10`. Cache-bypass rules, route counts, and route ordering remain unchanged. User-supplied `rscSuffix` and `shellPrefix` remain valid query parameters. Standard `next dev` and `next start` routing, and Vercel's legacy deployment path, do not use these generated adapter routes.
unstubbable
force-pushed
the
hl/fix-rsc-suffix-leak
branch
from
September 12, 2026 07:16
5dce168 to
636f5f7
Compare
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.
The Vercel adapter enables
passQuery: true, which forwards named route captures to prerender functions as query parameters instead of using the legacy route-matches header. When a request bypasses prerendered output, this also exposes internal path-building captures through applicationsearchParams. Withexperimental.collapseAdapterRoutesdisabled, RSC renders can receiverscSuffix=.rsc. With the flag enabled, document and Server Action renders can also receiverscSuffix=, and collapsed fallback shells can expose values such asshellPrefix=en. These additions can overwrite user query parameters and cause unnecessary navigation retries.When using an adapter, we now emit unnamed captures for these path-only values. For example,
(?<shellPrefix>de|en)and its destination reference$shellPrefixbecome(de|en)and$1when no locale capture precedes the group. Likewise,(?<rscSuffix>...)and$rscSuffixbecome(...)and a positional reference such as$2when one capture precedes the suffix. The generator accounts for parameter and locale captures and escapes literal base paths. Destination substitution runs once, preserving captured text and correctly distinguishing references such as$1and$10.Cache-bypass rules, route counts, and route ordering remain unchanged. User-supplied
rscSuffixandshellPrefixremain valid query parameters. Standardnext devandnext startrouting, and Vercel's legacy deployment path, do not use these generated adapter routes, and thus are not affected.