Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
94fff09a
Unverified
Commit
94fff09a
authored
Aug 18, 2026
by
David Alexandru Ilie
Committed by
GitHub
Aug 18, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preserve fallback params in standalone shells
parent
0b7e96f4
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
277 additions
and
4 deletions
+277
-4
app-page-runtime.ts
packages/next/src/build/templates/app-page-runtime.ts
+11
-4
loading.tsx
...utes/fixtures/default/app/@slot/[...catchAll]/loading.tsx
+3
-0
page.tsx
...-routes/fixtures/default/app/@slot/[...catchAll]/page.tsx
+12
-0
default.tsx
...ll-parallel-routes/fixtures/default/app/@slot/default.tsx
+3
-0
loading.tsx
...efault/app/@slot/nested/[group]/[...catchAll]/loading.tsx
+3
-0
page.tsx
...s/default/app/@slot/nested/[group]/[...catchAll]/page.tsx
+12
-0
default.tsx
...ck-shell-parallel-routes/fixtures/default/app/default.tsx
+3
-0
layout.tsx
...ack-shell-parallel-routes/fixtures/default/app/layout.tsx
+20
-0
loading.tsx
...tures/default/app/nested/[group]/items/[item]/loading.tsx
+3
-0
page.tsx
...fixtures/default/app/nested/[group]/items/[item]/page.tsx
+12
-0
loading.tsx
...utes/fixtures/default/app/postpone/isr/[slug]/loading.tsx
+3
-0
page.tsx
...-routes/fixtures/default/app/postpone/isr/[slug]/page.tsx
+12
-0
next.config.js
...ack-shell-parallel-routes/fixtures/default/next.config.js
+9
-0
standalone-fallback-shell-parallel-routes.test.ts
...-routes/standalone-fallback-shell-parallel-routes.test.ts
+171
-0
No files found.
packages/next/src/build/templates/app-page-runtime.ts
View file @
94fff09a
...
...
@@ -1474,9 +1474,16 @@ export function createAppPageEntrypoint({
)
:
null
const
fallbackRouteParamsForRender
=
placeholderFallbackRouteParams
&&
placeholderFallbackRouteParams
.
length
>
0
const
isProductionFallbackShell
=
isProduction
&&
getRequestMeta
(
req
,
'renderFallbackShell'
)
const
fallbackRouteParamsForRender
=
isProductionFallbackShell
?
// The deployment requested the route's generic fallback shell,
// so every dynamic param must remain opaque. Placeholder values
// only describe params encoded in this particular pathname.
prerenderInfo
?.
fallbackRouteParams
:
placeholderFallbackRouteParams
&&
placeholderFallbackRouteParams
.
length
>
0
?
placeholderFallbackRouteParams
:
prerenderInfo
?.
fallbackRouteParams
...
...
@@ -1506,7 +1513,7 @@ export function createAppPageEntrypoint({
// In production or when debugging the static shell for a
// non-prerendered URL, use the prerender manifest's fallback route
// params which correctly identifies which params are unknown.
(
(
isProduction
&&
getRequestMeta
(
req
,
'renderFallbackShell'
))
||
(
isProductionFallbackShell
||
hasPlaceholderFallbackRouteParams
||
(
isDebugStaticShell
&&
!
isPrerendered
))
&&
fallbackRouteParamsForRender
...
...
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/@slot/[...catchAll]/loading.tsx
0 → 100644
View file @
94fff09a
export
default
function
SlotLoading
()
{
return
<
p
id=
"slot-loading"
>
/[...catchAll]
</
p
>
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/@slot/[...catchAll]/page.tsx
0 → 100644
View file @
94fff09a
export
default
async
function
SlotPage
({
params
,
}:
{
params
:
Promise
<
{
catchAll
:
string
[]
}
>
})
{
return
(
<>
<
p
id=
"slot-page"
>
/@slot/[...catchAll]
</
p
>
<
p
id=
"slot-params"
>
{
JSON
.
stringify
(
await
params
)
}
</
p
>
</>
)
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/@slot/default.tsx
0 → 100644
View file @
94fff09a
export
default
function
SlotDefault
()
{
return
null
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/@slot/nested/[group]/[...catchAll]/loading.tsx
0 → 100644
View file @
94fff09a
export
default
function
NestedSlotLoading
()
{
return
<
p
id=
"nested-slot-loading"
>
/@slot/nested/[group]/[...catchAll]
</
p
>
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/@slot/nested/[group]/[...catchAll]/page.tsx
0 → 100644
View file @
94fff09a
export
default
async
function
NestedSlotPage
({
params
,
}:
{
params
:
Promise
<
{
group
:
string
;
catchAll
:
string
[]
}
>
})
{
return
(
<>
<
p
id=
"nested-slot-page"
>
/@slot/nested/[group]/[...catchAll]
</
p
>
<
p
id=
"nested-slot-params"
>
{
JSON
.
stringify
(
await
params
)
}
</
p
>
</>
)
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/default.tsx
0 → 100644
View file @
94fff09a
export
default
function
Default
()
{
return
null
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/layout.tsx
0 → 100644
View file @
94fff09a
import
{
Suspense
}
from
'react'
export
default
function
RootLayout
({
children
,
slot
,
}:
{
children
:
React
.
ReactNode
slot
:
React
.
ReactNode
})
{
return
(
<
html
lang=
"en"
>
<
body
>
<
Suspense
>
<
div
id=
"children-slot"
>
{
children
}
</
div
>
<
div
id=
"parallel-slot"
>
{
slot
}
</
div
>
</
Suspense
>
</
body
>
</
html
>
)
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/nested/[group]/items/[item]/loading.tsx
0 → 100644
View file @
94fff09a
export
default
function
NestedLoading
()
{
return
<
p
id=
"nested-loading"
>
/nested/[group]/items/[item]
</
p
>
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/nested/[group]/items/[item]/page.tsx
0 → 100644
View file @
94fff09a
export
default
async
function
NestedPage
({
params
,
}:
{
params
:
Promise
<
{
group
:
string
;
item
:
string
}
>
})
{
return
(
<>
<
p
id=
"nested-page"
>
/nested/[group]/items/[item]
</
p
>
<
p
id=
"nested-params"
>
{
JSON
.
stringify
(
await
params
)
}
</
p
>
</>
)
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/postpone/isr/[slug]/loading.tsx
0 → 100644
View file @
94fff09a
export
default
function
Loading
()
{
return
<
p
id=
"loading"
>
/postpone/isr/[slug]
</
p
>
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/app/postpone/isr/[slug]/page.tsx
0 → 100644
View file @
94fff09a
export
default
async
function
Page
({
params
,
}:
{
params
:
Promise
<
{
slug
:
string
}
>
})
{
return
(
<>
<
p
id=
"page"
>
/postpone/isr/[slug]
</
p
>
<
p
id=
"params"
>
{
JSON
.
stringify
(
await
params
)
}
</
p
>
</>
)
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/fixtures/default/next.config.js
0 → 100644
View file @
94fff09a
/** @type {import('next').NextConfig} */
module
.
exports
=
{
cacheComponents
:
true
,
output
:
'standalone'
,
outputFileTracingRoot
:
process
.
cwd
(),
outputFileTracingIncludes
:
{
'/*'
:
[
'node_modules/@swc/helpers/**/*'
],
},
}
test/production/app-dir/standalone-fallback-shell-parallel-routes/standalone-fallback-shell-parallel-routes.test.ts
0 → 100644
View file @
94fff09a
import
fs
from
'node:fs/promises'
import
type
{
ChildProcess
}
from
'node:child_process'
import
{
join
}
from
'node:path'
import
cheerio
from
'cheerio'
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
fetchViaHTTP
,
findPort
,
initNextServerScript
,
killApp
,
withInvocationId
,
}
from
'next-test-utils'
describe
(
'standalone fallback shells with parallel routes'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
join
(
__dirname
,
'fixtures/default'
),
skipDeployment
:
true
,
skipStart
:
true
,
})
let
server
:
ChildProcess
let
appPort
:
number
beforeAll
(
async
()
=>
{
process
.
env
.
NOW_BUILDER
=
'1'
process
.
env
.
NEXT_PRIVATE_TEST_HEADERS
=
'1'
const
{
exitCode
}
=
await
next
.
build
()
if
(
exitCode
!==
0
)
{
throw
new
Error
(
`next build failed with exit code
${
exitCode
}
`
)
}
const
serverFilePath
=
join
(
next
.
testDir
,
'.next/standalone/server.js'
)
await
fs
.
writeFile
(
serverFilePath
,
(
await
fs
.
readFile
(
serverFilePath
,
'utf8'
)).
replace
(
'port:'
,
'minimalMode: true, port:'
)
)
appPort
=
await
findPort
()
server
=
await
initNextServerScript
(
serverFilePath
,
/- Local:/
,
{
...
process
.
env
,
...
next
.
env
,
__NEXT_TEST_MODE
:
'e2e'
,
PORT
:
`
${
appPort
}
`
,
},
undefined
,
{
cwd
:
next
.
testDir
}
)
})
afterAll
(
async
()
=>
{
delete
process
.
env
.
NOW_BUILDER
delete
process
.
env
.
NEXT_PRIVATE_TEST_HEADERS
if
(
server
)
await
killApp
(
server
)
})
async
function
fetchGenericFallbackShell
(
pathname
:
string
,
matchedPath
:
string
)
{
// These private headers model the request a platform adapter sends when it
// asks a standalone server for the generic shell of a dynamic route.
return
fetchViaHTTP
(
appPort
,
pathname
,
undefined
,
withInvocationId
({
headers
:
{
'x-matched-path'
:
matchedPath
,
'x-now-route-matches'
:
''
,
},
})
)
}
it
(
'renders ordinary concrete params normally'
,
async
()
=>
{
const
response
=
await
fetchViaHTTP
(
appPort
,
'/postpone/isr/concrete'
)
expect
(
response
.
status
).
toBe
(
200
)
expect
(
response
.
headers
.
get
(
'x-nextjs-postponed'
)).
toBeNull
()
const
$
=
cheerio
.
load
(
await
response
.
text
())
expect
(
$
(
'#page'
).
text
()).
toBe
(
'/postpone/isr/[slug]'
)
expect
(
$
(
'#params'
).
text
()).
toBe
(
'{"slug":"concrete"}'
)
expect
(
$
(
'#slot-page'
).
text
()).
toBe
(
'/@slot/[...catchAll]'
)
expect
(
$
(
'#slot-params'
).
text
()).
toBe
(
'{"catchAll":["postpone","isr","concrete"]}'
)
})
it
(
'keeps all unknown sibling params suspended in a generic fallback shell'
,
async
()
=>
{
for
(
let
attempt
=
0
;
attempt
<
2
;
attempt
++
)
{
const
response
=
await
fetchGenericFallbackShell
(
'/postpone/isr/[slug]'
,
'/postpone/isr/[slug]'
)
expect
(
response
.
status
).
toBe
(
200
)
expect
(
response
.
headers
.
get
(
'x-nextjs-postponed'
)).
toBe
(
'1'
)
const
html
=
await
response
.
text
()
expect
(
html
).
not
.
toContain
(
'</html>'
)
expect
(
html
).
not
.
toContain
(
'%%drp:'
)
const
$
=
cheerio
.
load
(
html
)
expect
({
page
:
$
(
'#page'
).
text
(),
params
:
$
(
'#params'
).
text
(),
slotPage
:
$
(
'#slot-page'
).
text
(),
slotParams
:
$
(
'#slot-params'
).
text
(),
}).
toEqual
({
page
:
''
,
params
:
''
,
slotPage
:
''
,
slotParams
:
''
,
})
expect
(
$
(
'#loading'
).
text
()).
toBe
(
'/postpone/isr/[slug]'
)
expect
(
$
(
'#slot-loading'
).
text
()).
toBe
(
'/[...catchAll]'
)
}
})
it
(
'keeps all unknown nested params suspended in a generic fallback shell'
,
async
()
=>
{
const
response
=
await
fetchGenericFallbackShell
(
'/nested/[group]/items/[item]'
,
'/nested/[group]/items/[item]'
)
expect
(
response
.
status
).
toBe
(
200
)
expect
(
response
.
headers
.
get
(
'x-nextjs-postponed'
)).
toBe
(
'1'
)
const
$
=
cheerio
.
load
(
await
response
.
text
())
expect
({
page
:
$
(
'#nested-page'
).
text
(),
params
:
$
(
'#nested-params'
).
text
(),
slotPage
:
$
(
'#nested-slot-page'
).
text
(),
slotParams
:
$
(
'#nested-slot-params'
).
text
(),
}).
toEqual
({
page
:
''
,
params
:
''
,
slotPage
:
''
,
slotParams
:
''
,
})
expect
(
$
(
'#nested-loading'
).
text
()).
toBe
(
'/nested/[group]/items/[item]'
)
expect
(
$
(
'#nested-slot-loading'
).
text
()).
toBe
(
'/@slot/nested/[group]/[...catchAll]'
)
})
it
(
'renders ordinary nested concrete params normally'
,
async
()
=>
{
const
response
=
await
fetchViaHTTP
(
appPort
,
'/nested/team/items/widget'
)
expect
(
response
.
status
).
toBe
(
200
)
expect
(
response
.
headers
.
get
(
'x-nextjs-postponed'
)).
toBeNull
()
const
$
=
cheerio
.
load
(
await
response
.
text
())
expect
(
$
(
'#nested-page'
).
text
()).
toBe
(
'/nested/[group]/items/[item]'
)
expect
(
$
(
'#nested-params'
).
text
()).
toBe
(
'{"group":"team","item":"widget"}'
)
expect
(
$
(
'#nested-slot-page'
).
text
()).
toBe
(
'/@slot/nested/[group]/[...catchAll]'
)
expect
(
$
(
'#nested-slot-params'
).
text
()).
toBe
(
'{"group":"team","catchAll":["items","widget"]}'
)
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment