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
ff40d0a2
Unverified
Commit
ff40d0a2
authored
Oct 19, 2024
by
Sebastian Markbåge
Committed by
GitHub
Oct 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass cacheLifeProfiles during static path generation (#71502)
So that you can use cache during generateStaticParams.
parent
f5867d38
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
index.ts
packages/next/src/build/index.ts
+2
-0
next-dev-server.ts
packages/next/src/server/dev/next-dev-server.ts
+1
-0
page.tsx
test/e2e/app-dir/use-cache/app/[id]/page.tsx
+12
-0
No files found.
packages/next/src/build/index.ts
View file @
ff40d0a2
...
@@ -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
,
})
})
}
}
...
...
packages/next/src/server/dev/next-dev-server.ts
View file @
ff40d0a2
...
@@ -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
,
...
...
test/e2e/app-dir/use-cache/app/[id]/page.tsx
0 → 100644
View file @
ff40d0a2
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'
}
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