Unverified Commit 1e73fa94 authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

adapters: remove unused suffix code (#91997)

The regex associated with this flag was the same value in both the
true/false case and the underlying flag was only used to control this
regex. This appears to be dead code, so removing it.
parent 90450112
...@@ -1958,8 +1958,6 @@ export async function handleBuildComplete({ ...@@ -1958,8 +1958,6 @@ export async function handleBuildComplete({
const isFallbackFalse = const isFallbackFalse =
prerenderManifest.dynamicRoutes[route.page]?.fallback === false prerenderManifest.dynamicRoutes[route.page]?.fallback === false
const { hasFallbackRootParams } = route
const sourceRegex = routeRegex.namedRegex.replace( const sourceRegex = routeRegex.namedRegex.replace(
'^', '^',
`^${config.basePath && config.basePath !== '/' ? path.posix.join('/', config.basePath || '') : ''}[/]?${shouldLocalize ? '(?<nextLocale>[^/]{1,})' : ''}` `^${config.basePath && config.basePath !== '/' ? path.posix.join('/', config.basePath || '') : ''}[/]?${shouldLocalize ? '(?<nextLocale>[^/]{1,})' : ''}`
...@@ -1973,23 +1971,11 @@ export async function handleBuildComplete({ ...@@ -1973,23 +1971,11 @@ export async function handleBuildComplete({
) + getDestinationQuery(route.routeKeys) ) + getDestinationQuery(route.routeKeys)
if (appPageKeys && appPageKeys.length > 0) { if (appPageKeys && appPageKeys.length > 0) {
// If we have fallback root params (implying we've already
// emitted a rewrite for the /_tree request), or if the route
// has PPR enabled and client param parsing is enabled, then
// we don't need to include any other suffixes.
const shouldSkipSuffixes = hasFallbackRootParams
dynamicRoutes.push({ dynamicRoutes.push({
source: route.page + '.rsc', source: route.page + '.rsc',
sourceRegex: sourceRegex.replace( sourceRegex: sourceRegex.replace(
new RegExp(escapeStringRegexp('(?:/)?$')), new RegExp(escapeStringRegexp('(?:/)?$')),
// Now than the upstream issues has been resolved, we can safely '(?<rscSuffix>\\.rsc|\\.segments/.+\\.segment\\.rsc)(?:/)?$'
// add the suffix back, this resolves a bug related to segment
// rewrites not capturing the correct suffix values when
// enabled.
shouldSkipSuffixes
? '(?<rscSuffix>\\.rsc|\\.segments/.+\\.segment\\.rsc)(?:/)?$'
: '(?<rscSuffix>\\.rsc|\\.segments/.+\\.segment\\.rsc)(?:/)?$'
), ),
destination: destination?.replace(/($|\?)/, '$rscSuffix$1'), destination: destination?.replace(/($|\?)/, '$rscSuffix$1'),
has: has:
......
...@@ -401,12 +401,6 @@ export type ManifestRoute = ManifestBuiltRoute & { ...@@ -401,12 +401,6 @@ export type ManifestRoute = ManifestBuiltRoute & {
namedRegex: string namedRegex: string
routeKeys: { [key: string]: string } routeKeys: { [key: string]: string }
/**
* If true, this indicates that the route has fallback root params. This is
* used to simplify the route regex for matching.
*/
hasFallbackRootParams?: boolean
/** /**
* The prefetch segment data routes for this route. This is used to rewrite * The prefetch segment data routes for this route. This is used to rewrite
* the prefetch segment data routes (or the inverse) to the correct * the prefetch segment data routes (or the inverse) to the correct
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment