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
4a90ff74
Unverified
Commit
4a90ff74
authored
Jul 24, 2025
by
JJ Kasper
Committed by
GitHub
Jul 24, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[backport] Fix dynamicParams false layout case in dev (#82026)
parent
9bf932c0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
148 additions
and
18 deletions
+148
-18
app-page.ts
packages/next/src/build/templates/app-page.ts
+1
-1
app-route.ts
packages/next/src/build/templates/app-route.ts
+1
-1
pages.ts
packages/next/src/build/templates/pages.ts
+16
-15
next-dev-server.ts
packages/next/src/server/dev/next-dev-server.ts
+6
-1
app-static.test.ts
test/e2e/app-dir/app-static/app-static.test.ts
+89
-0
page.js
...p-static/app/partial-params-false/[locale]/[slug]/page.js
+10
-0
layout.js
...ir/app-static/app/partial-params-false/[locale]/layout.js
+16
-0
page.js
...p-static/app/partial-params-false/[locale]/static/page.js
+9
-0
No files found.
packages/next/src/build/templates/app-page.ts
View file @
4a90ff74
...
@@ -1180,7 +1180,7 @@ export async function handler(
...
@@ -1180,7 +1180,7 @@ export async function handler(
}
}
} catch (err) {
} catch (err) {
// if we aren't wrapped by base-server handle here
// if we aren't wrapped by base-server handle here
if (!activeSpan) {
if (!activeSpan
&& !(err instanceof NoFallbackError)
) {
await routeModule.onRequestError(
await routeModule.onRequestError(
req,
req,
err,
err,
...
...
packages/next/src/build/templates/app-route.ts
View file @
4a90ff74
...
@@ -449,7 +449,7 @@ export async function handler(
...
@@ -449,7 +449,7 @@ export async function handler(
}
}
} catch (err) {
} catch (err) {
// if we aren't wrapped by base-server handle here
// if we aren't wrapped by base-server handle here
if (!activeSpan) {
if (!activeSpan
&& !(err instanceof NoFallbackError)
) {
await routeModule.onRequestError(req, err, {
await routeModule.onRequestError(req, err, {
routerKind: 'App Router',
routerKind: 'App Router',
routePath: normalizedSrcPage,
routePath: normalizedSrcPage,
...
...
packages/next/src/build/templates/pages.ts
View file @
4a90ff74
...
@@ -765,21 +765,22 @@ export async function handler(
...
@@ -765,21 +765,22 @@ export async function handler(
)
)
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
await
routeModule
.
onRequestError
(
if
(
!
(
err
instanceof
NoFallbackError
))
{
req
,
await
routeModule
.
onRequestError
(
err
,
req
,
{
err
,
routerKind
:
'Pages Router'
,
{
routePath
:
srcPage
,
routerKind
:
'Pages Router'
,
routeType
:
'render'
,
routePath
:
srcPage
,
revalidateReason
:
getRevalidateReason
({
routeType
:
'render'
,
isRevalidate
:
hasStaticProps
,
revalidateReason
:
getRevalidateReason
({
isOnDemandRevalidate
,
isRevalidate
:
hasStaticProps
,
}),
isOnDemandRevalidate
,
},
}),
routerServerContext
},
)
routerServerContext
)
}
// rethrow so that we can handle serving error page
// rethrow so that we can handle serving error page
throw
err
throw
err
}
}
...
...
packages/next/src/server/dev/next-dev-server.ts
View file @
4a90ff74
...
@@ -874,7 +874,12 @@ export default class DevServer extends Server {
...
@@ -874,7 +874,12 @@ export default class DevServer extends Server {
fallbackMode
:
fallback
,
fallbackMode
:
fallback
,
}
}
if
(
res
.
value
?.
fallbackMode
!==
undefined
)
{
if
(
res
.
value
?.
fallbackMode
!==
undefined
&&
// This matches the hasGenerateStaticParams logic
// we do during build
(
!
isAppPath
||
(
staticPaths
&&
staticPaths
.
length
>
0
))
)
{
// we write the static paths to partial manifest for
// we write the static paths to partial manifest for
// fallback handling inside of entry handler's
// fallback handling inside of entry handler's
const
rawExistingManifest
=
await
fs
.
promises
.
readFile
(
const
rawExistingManifest
=
await
fs
.
promises
.
readFile
(
...
...
test/e2e/app-dir/app-static/app-static.test.ts
View file @
4a90ff74
...
@@ -40,6 +40,18 @@ describe('app-dir static/dynamic handling', () => {
...
@@ -40,6 +40,18 @@ describe('app-dir static/dynamic handling', () => {
}
}
})
})
if
(
!
process
.
env
.
__NEXT_EXPERIMENTAL_PPR
)
{
it
(
'should respond correctly for dynamic route with dynamicParams false in layout'
,
async
()
=>
{
const
res
=
await
next
.
fetch
(
'/partial-params-false/en/another'
)
expect
(
res
.
status
).
toBe
(
200
)
})
it
(
'should respond correctly for partially dynamic route with dynamicParams false in layout'
,
async
()
=>
{
const
res
=
await
next
.
fetch
(
'/partial-params-false/en/static'
)
expect
(
res
.
status
).
toBe
(
200
)
})
}
it
(
'should use auto no cache when no fetch config'
,
async
()
=>
{
it
(
'should use auto no cache when no fetch config'
,
async
()
=>
{
const
res
=
await
next
.
fetch
(
'/no-config-fetch'
)
const
res
=
await
next
.
fetch
(
'/no-config-fetch'
)
expect
(
res
.
status
).
toBe
(
200
)
expect
(
res
.
status
).
toBe
(
200
)
...
@@ -877,6 +889,10 @@ describe('app-dir static/dynamic handling', () => {
...
@@ -877,6 +889,10 @@ describe('app-dir static/dynamic handling', () => {
"partial-gen-params-no-additional-slug/fr/first.rsc",
"partial-gen-params-no-additional-slug/fr/first.rsc",
"partial-gen-params-no-additional-slug/fr/second.html",
"partial-gen-params-no-additional-slug/fr/second.html",
"partial-gen-params-no-additional-slug/fr/second.rsc",
"partial-gen-params-no-additional-slug/fr/second.rsc",
"partial-params-false/en/static.html",
"partial-params-false/en/static.rsc",
"partial-params-false/fr/static.html",
"partial-params-false/fr/static.rsc",
"prerendered-not-found/first.html",
"prerendered-not-found/first.html",
"prerendered-not-found/first.rsc",
"prerendered-not-found/first.rsc",
"prerendered-not-found/second.html",
"prerendered-not-found/second.html",
...
@@ -1822,6 +1838,54 @@ describe('app-dir static/dynamic handling', () => {
...
@@ -1822,6 +1838,54 @@ describe('app-dir static/dynamic handling', () => {
"initialRevalidateSeconds": false,
"initialRevalidateSeconds": false,
"srcRoute": "/partial-gen-params-no-additional-slug/[lang]/[slug]",
"srcRoute": "/partial-gen-params-no-additional-slug/[lang]/[slug]",
},
},
"/partial-params-false/en/static": {
"allowHeader": [
"host",
"x-matched-path",
"x-prerender-revalidate",
"x-prerender-revalidate-if-generated",
"x-next-revalidated-tags",
"x-next-revalidate-tag-token",
],
"dataRoute": "/partial-params-false/en/static.rsc",
"experimentalBypassFor": [
{
"key": "Next-Action",
"type": "header",
},
{
"key": "content-type",
"type": "header",
"value": "multipart/form-data;.*",
},
],
"initialRevalidateSeconds": false,
"srcRoute": "/partial-params-false/[locale]/static",
},
"/partial-params-false/fr/static": {
"allowHeader": [
"host",
"x-matched-path",
"x-prerender-revalidate",
"x-prerender-revalidate-if-generated",
"x-next-revalidated-tags",
"x-next-revalidate-tag-token",
],
"dataRoute": "/partial-params-false/fr/static.rsc",
"experimentalBypassFor": [
{
"key": "Next-Action",
"type": "header",
},
{
"key": "content-type",
"type": "header",
"value": "multipart/form-data;.*",
},
],
"initialRevalidateSeconds": false,
"srcRoute": "/partial-params-false/[locale]/static",
},
"/prerendered-not-found/first": {
"/prerendered-not-found/first": {
"allowHeader": [
"allowHeader": [
"host",
"host",
...
@@ -2580,6 +2644,31 @@ describe('app-dir static/dynamic handling', () => {
...
@@ -2580,6 +2644,31 @@ describe('app-dir static/dynamic handling', () => {
"fallback": false,
"fallback": false,
"routeRegex": "^\\/partial\\-gen\\-params\\-no\\-additional\\-slug\\/([^\\/]+?)\\/([^\\/]+?)(?:\\/)?$",
"routeRegex": "^\\/partial\\-gen\\-params\\-no\\-additional\\-slug\\/([^\\/]+?)\\/([^\\/]+?)(?:\\/)?$",
},
},
"/partial-params-false/[locale]/static": {
"allowHeader": [
"host",
"x-matched-path",
"x-prerender-revalidate",
"x-prerender-revalidate-if-generated",
"x-next-revalidated-tags",
"x-next-revalidate-tag-token",
],
"dataRoute": "/partial-params-false/[locale]/static.rsc",
"dataRouteRegex": "^\\/partial\\-params\\-false\\/([^\\/]+?)\\/static\\.rsc$",
"experimentalBypassFor": [
{
"key": "Next-Action",
"type": "header",
},
{
"key": "content-type",
"type": "header",
"value": "multipart/form-data;.*",
},
],
"fallback": false,
"routeRegex": "^\\/partial\\-params\\-false\\/([^\\/]+?)\\/static(?:\\/)?$",
},
"/prerendered-not-found/[slug]": {
"/prerendered-not-found/[slug]": {
"allowHeader": [
"allowHeader": [
"host",
"host",
...
...
test/e2e/app-dir/app-static/app/partial-params-false/[locale]/[slug]/page.js
0 → 100644
View file @
4a90ff74
export
default
async
function
Page
({
params
})
{
const
{
locale
,
slug
}
=
await
params
return
(
<>
<
p
>
/
[
locale
]
/
[
slug
]
/
page
<
/p
>
<
p
>
params
:
{
JSON
.
stringify
({
locale
,
slug
})}
<
/p
>
<
/
>
)
}
test/e2e/app-dir/app-static/app/partial-params-false/[locale]/layout.js
0 → 100644
View file @
4a90ff74
export
const
dynamicParams
=
false
export
function
generateStaticParams
()
{
return
[
{
locale
:
'en'
,
},
{
locale
:
'fr'
,
},
]
}
export
default
function
Layout
({
children
})
{
return
<>
{
children
}
<
/
>
}
test/e2e/app-dir/app-static/app/partial-params-false/[locale]/static/page.js
0 → 100644
View file @
4a90ff74
export
default
async
function
Page
({
params
})
{
const
{
locale
}
=
await
params
return
(
<>
<
p
>
/
[
locale
]
/
static
<
/p
>
<
p
>
locale
:
{
locale
}
<
/p
>
<
/
>
)
}
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