Unverified Commit ff40d0a2 authored by Sebastian Markbåge's avatar Sebastian Markbåge Committed by GitHub

Pass cacheLifeProfiles during static path generation (#71502)

So that you can use cache during generateStaticParams.
parent f5867d38
...@@ -1952,6 +1952,7 @@ export default async function build( ...@@ -1952,6 +1952,7 @@ export default async function build(
defaultLocale: config.i18n?.defaultLocale, defaultLocale: config.i18n?.defaultLocale,
nextConfigOutput: config.output, nextConfigOutput: config.output,
pprConfig: config.experimental.ppr, pprConfig: config.experimental.ppr,
cacheLifeProfiles: config.experimental.cacheLife,
buildId, buildId,
}) })
) )
...@@ -2176,6 +2177,7 @@ export default async function build( ...@@ -2176,6 +2177,7 @@ export default async function build(
maxMemoryCacheSize: config.cacheMaxMemorySize, maxMemoryCacheSize: config.cacheMaxMemorySize,
nextConfigOutput: config.output, nextConfigOutput: config.output,
pprConfig: config.experimental.ppr, pprConfig: config.experimental.ppr,
cacheLifeProfiles: config.experimental.cacheLife,
buildId, buildId,
}) })
} }
......
...@@ -773,6 +773,7 @@ export default class DevServer extends Server { ...@@ -773,6 +773,7 @@ export default class DevServer extends Server {
isAppPath, isAppPath,
requestHeaders, requestHeaders,
cacheHandler: this.nextConfig.cacheHandler, cacheHandler: this.nextConfig.cacheHandler,
cacheLifeProfiles: this.nextConfig.experimental.cacheLife,
fetchCacheKeyPrefix: this.nextConfig.experimental.fetchCacheKeyPrefix, fetchCacheKeyPrefix: this.nextConfig.experimental.fetchCacheKeyPrefix,
isrFlushToDisk: this.nextConfig.experimental.isrFlushToDisk, isrFlushToDisk: this.nextConfig.experimental.isrFlushToDisk,
maxMemoryCacheSize: this.nextConfig.cacheMaxMemorySize, maxMemoryCacheSize: this.nextConfig.cacheMaxMemorySize,
......
async function getCachedRandom(n: number) {
'use cache'
return String(Math.ceil(Math.random() * n))
}
export async function generateStaticParams() {
return [{ id: await getCachedRandom(10) }, { id: await getCachedRandom(2) }]
}
export default async function Page() {
return 'hit'
}
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