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
e3689364
Unverified
Commit
e3689364
authored
Mar 01, 2025
by
Hendrik Liebau
Committed by
GitHub
Mar 01, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix uniqueness detection for `generateStaticParams` (#76713)
parent
170f4597
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
1 deletion
+102
-1
app.ts
packages/next/src/build/static-paths/app.ts
+1
-1
app-static.test.ts
test/e2e/app-dir/app-static/app-static.test.ts
+84
-0
page.js
...-static/app/gen-params-catch-all-unique/[...slug]/page.js
+17
-0
No files found.
packages/next/src/build/static-paths/app.ts
View file @
e3689364
...
@@ -38,7 +38,7 @@ function areParamValuesEqual(a: ParamValue, b: ParamValue) {
...
@@ -38,7 +38,7 @@ function areParamValuesEqual(a: ParamValue, b: ParamValue) {
return
false
return
false
}
}
return
a
.
every
((
item
)
=>
b
.
includes
(
item
)
)
return
a
.
every
((
item
,
index
)
=>
item
===
b
[
index
]
)
}
}
// Otherwise, they're not equal.
// Otherwise, they're not equal.
...
...
test/e2e/app-dir/app-static/app-static.test.ts
View file @
e3689364
...
@@ -833,6 +833,10 @@ describe('app-dir static/dynamic handling', () => {
...
@@ -833,6 +833,10 @@ describe('app-dir static/dynamic handling', () => {
"force-static/first.rsc",
"force-static/first.rsc",
"force-static/second.html",
"force-static/second.html",
"force-static/second.rsc",
"force-static/second.rsc",
"gen-params-catch-all-unique/foo/bar.html",
"gen-params-catch-all-unique/foo/bar.rsc",
"gen-params-catch-all-unique/foo/foo.html",
"gen-params-catch-all-unique/foo/foo.rsc",
"gen-params-dynamic-revalidate/one.html",
"gen-params-dynamic-revalidate/one.html",
"gen-params-dynamic-revalidate/one.rsc",
"gen-params-dynamic-revalidate/one.rsc",
"hooks/use-pathname/slug.html",
"hooks/use-pathname/slug.html",
...
@@ -1314,6 +1318,54 @@ describe('app-dir static/dynamic handling', () => {
...
@@ -1314,6 +1318,54 @@ describe('app-dir static/dynamic handling', () => {
"initialRevalidateSeconds": false,
"initialRevalidateSeconds": false,
"srcRoute": "/force-static/[slug]",
"srcRoute": "/force-static/[slug]",
},
},
"/gen-params-catch-all-unique/foo/bar": {
"allowHeader": [
"host",
"x-matched-path",
"x-prerender-revalidate",
"x-prerender-revalidate-if-generated",
"x-next-revalidated-tags",
"x-next-revalidate-tag-token",
],
"dataRoute": "/gen-params-catch-all-unique/foo/bar.rsc",
"experimentalBypassFor": [
{
"key": "Next-Action",
"type": "header",
},
{
"key": "content-type",
"type": "header",
"value": "multipart/form-data;.*",
},
],
"initialRevalidateSeconds": false,
"srcRoute": "/gen-params-catch-all-unique/[...slug]",
},
"/gen-params-catch-all-unique/foo/foo": {
"allowHeader": [
"host",
"x-matched-path",
"x-prerender-revalidate",
"x-prerender-revalidate-if-generated",
"x-next-revalidated-tags",
"x-next-revalidate-tag-token",
],
"dataRoute": "/gen-params-catch-all-unique/foo/foo.rsc",
"experimentalBypassFor": [
{
"key": "Next-Action",
"type": "header",
},
{
"key": "content-type",
"type": "header",
"value": "multipart/form-data;.*",
},
],
"initialRevalidateSeconds": false,
"srcRoute": "/gen-params-catch-all-unique/[...slug]",
},
"/gen-params-dynamic-revalidate/one": {
"/gen-params-dynamic-revalidate/one": {
"allowHeader": [
"allowHeader": [
"host",
"host",
...
@@ -2430,6 +2482,31 @@ describe('app-dir static/dynamic handling', () => {
...
@@ -2430,6 +2482,31 @@ describe('app-dir static/dynamic handling', () => {
"fallback": null,
"fallback": null,
"routeRegex": "^\\/force\\-static\\/([^\\/]+?)(?:\\/)?$",
"routeRegex": "^\\/force\\-static\\/([^\\/]+?)(?:\\/)?$",
},
},
"/gen-params-catch-all-unique/[...slug]": {
"allowHeader": [
"host",
"x-matched-path",
"x-prerender-revalidate",
"x-prerender-revalidate-if-generated",
"x-next-revalidated-tags",
"x-next-revalidate-tag-token",
],
"dataRoute": "/gen-params-catch-all-unique/[...slug].rsc",
"dataRouteRegex": "^\\/gen\\-params\\-catch\\-all\\-unique\\/(.+?)\\.rsc$",
"experimentalBypassFor": [
{
"key": "Next-Action",
"type": "header",
},
{
"key": "content-type",
"type": "header",
"value": "multipart/form-data;.*",
},
],
"fallback": false,
"routeRegex": "^\\/gen\\-params\\-catch\\-all\\-unique\\/(.+?)(?:\\/)?$",
},
"/gen-params-dynamic-revalidate/[slug]": {
"/gen-params-dynamic-revalidate/[slug]": {
"allowHeader": [
"allowHeader": [
"host",
"host",
...
@@ -3678,6 +3755,13 @@ describe('app-dir static/dynamic handling', () => {
...
@@ -3678,6 +3755,13 @@ describe('app-dir static/dynamic handling', () => {
})
})
if
(
!
process
.
env
.
CUSTOM_CACHE_HANDLER
)
{
if
(
!
process
.
env
.
CUSTOM_CACHE_HANDLER
)
{
it
(
'should not filter out catch-all params with repeated segments in generateStaticParams'
,
async
()
=>
{
const
res1
=
await
next
.
fetch
(
'/gen-params-catch-all-unique/foo/foo'
)
expect
(
res1
.
status
).
toBe
(
200
)
const
res2
=
await
next
.
fetch
(
'/gen-params-catch-all-unique/foo/bar'
)
expect
(
res2
.
status
).
toBe
(
200
)
})
it
(
'should honor dynamic = "force-static" correctly'
,
async
()
=>
{
it
(
'should honor dynamic = "force-static" correctly'
,
async
()
=>
{
const
res
=
await
next
.
fetch
(
'/force-static/first'
)
const
res
=
await
next
.
fetch
(
'/force-static/first'
)
expect
(
res
.
status
).
toBe
(
200
)
expect
(
res
.
status
).
toBe
(
200
)
...
...
test/e2e/app-dir/app-static/app/gen-params-catch-all-unique/[...slug]/page.js
0 → 100644
View file @
e3689364
export
const
dynamicParams
=
false
export
default
async
function
Page
({
params
})
{
const
{
slug
}
=
await
params
return
<
p
>
Test
{
slug
.
join
(
'/'
)}
<
/p
>
}
export
function
generateStaticParams
()
{
return
[
{
slug
:
[
'foo'
,
'foo'
],
},
{
slug
:
[
'foo'
,
'bar'
],
},
]
}
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