Skip to content

Commit 5f26360

Browse files
committed
fix generateStaticParams case
1 parent f78ef00 commit 5f26360

File tree

3 files changed

+17
-0
lines changed
  • packages/next/src/build
  • test/e2e/app-dir/app-static/app
    • partial-gen-params-no-additional-lang/[lang]/[slug]
    • partial-gen-params-no-additional-slug/[lang]/[slug]

3 files changed

+17
-0
lines changed

packages/next/src/build/utils.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,21 @@ export async function buildAppStaticPaths({
14381438
const newParams: Params[] = []
14391439

14401440
if (curGenerate.generateStaticParams) {
1441+
const curStore =
1442+
ComponentMod.staticGenerationAsyncStorage.getStore()
1443+
1444+
if (curStore) {
1445+
if (typeof curGenerate?.config?.fetchCache !== 'undefined') {
1446+
curStore.fetchCache = curGenerate.config.fetchCache
1447+
}
1448+
if (typeof curGenerate?.config?.revalidate !== 'undefined') {
1449+
curStore.revalidate = curGenerate.config.revalidate
1450+
}
1451+
if (curGenerate?.config?.dynamic === 'force-dynamic') {
1452+
curStore.forceDynamic = true
1453+
}
1454+
}
1455+
14411456
for (const params of paramsItems) {
14421457
const result = await curGenerate.generateStaticParams({
14431458
params,

test/e2e/app-dir/app-static/app/partial-gen-params-no-additional-lang/[lang]/[slug]/page.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export const dynamicParams = true
2+
export const fetchCache = 'default-cache'
23

34
export async function generateStaticParams() {
45
const res = await fetch(

test/e2e/app-dir/app-static/app/partial-gen-params-no-additional-slug/[lang]/[slug]/page.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export const dynamicParams = false
2+
export const fetchCache = 'default-cache'
23

34
export async function generateStaticParams() {
45
const res = await fetch(

0 commit comments

Comments
 (0)