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
e75fe68a
Unverified
Commit
e75fe68a
authored
Aug 20, 2025
by
Hendrik Liebau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update directives
parent
42f5931d
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
38 additions
and
38 deletions
+38
-38
page.tsx
.../use-cache/app/(dynamic)/cache-fetch-auth-header/page.tsx
+1
-1
page.tsx
...e2e/app-dir/use-cache/app/(dynamic)/complex-args/page.tsx
+1
-1
page.tsx
...app-dir/use-cache/app/(dynamic)/fetch-revalidate/page.tsx
+1
-1
cached-data.ts
.../use-cache/app/(dynamic)/generate-metadata/cached-data.ts
+1
-1
page.tsx
...pp-dir/use-cache/app/(dynamic)/generate-metadata/page.tsx
+1
-1
page.tsx
test/e2e/app-dir/use-cache/app/(dynamic)/page.tsx
+1
-1
page.tsx
.../use-cache/app/(dynamic)/revalidate-and-redirect/page.tsx
+1
-1
page.tsx
...p-dir/use-cache/app/(dynamic)/revalidate-and-use/page.tsx
+1
-1
page.tsx
...2e/app-dir/use-cache/app/(partially-static)/[id]/page.tsx
+1
-1
route.ts
...e2e/app-dir/use-cache/app/(partially-static)/api/route.ts
+1
-1
page.tsx
...ache/app/(partially-static)/cache-fetch-no-store/page.tsx
+1
-1
page.tsx
...dir/use-cache/app/(partially-static)/cache-fetch/page.tsx
+1
-1
page.tsx
...-dir/use-cache/app/(partially-static)/cache-life/page.tsx
+1
-1
page.tsx
...p-dir/use-cache/app/(partially-static)/cache-tag/page.tsx
+1
-1
page.tsx
...e-cache/app/(partially-static)/draft-mode/[mode]/page.tsx
+3
-3
page.tsx
...2e/app-dir/use-cache/app/(partially-static)/form/page.tsx
+1
-1
cached.ts
...che/app/(partially-static)/imported-from-client/cached.ts
+1
-1
page.tsx
...2e/app-dir/use-cache/app/(partially-static)/logs/page.tsx
+2
-2
cached.ts
...r/use-cache/app/(partially-static)/method-props/cached.ts
+1
-1
page.tsx
.../app/(partially-static)/nested-in-unstable-cache/page.tsx
+1
-1
page.tsx
...p-dir/use-cache/app/(partially-static)/not-found/page.tsx
+1
-1
page.tsx
...ache/app/(partially-static)/on-demand-revalidate/page.tsx
+1
-1
page.tsx
...se-cache/app/(partially-static)/passed-to-client/page.tsx
+3
-3
page.tsx
...e2e/app-dir/use-cache/app/(partially-static)/rdc/page.tsx
+3
-3
page.tsx
...dir/use-cache/app/(partially-static)/react-cache/page.tsx
+1
-1
page.tsx
...ache/app/(partially-static)/referential-equality/page.tsx
+2
-2
page.tsx
...dir/use-cache/app/(partially-static)/rsc-payload/page.tsx
+1
-1
cached.ts
...ache/app/(partially-static)/static-class-method/cached.ts
+1
-1
cached.ts
...e-cache/app/(partially-static)/use-action-state/cached.ts
+1
-1
page.tsx
...-cache/app/(partially-static)/with-server-action/page.tsx
+1
-1
No files found.
test/e2e/app-dir/use-cache/app/(dynamic)/cache-fetch-auth-header/page.tsx
View file @
e75fe68a
...
...
@@ -2,7 +2,7 @@ import { cookies } from 'next/headers'
import
React
from
'react'
async
function
getData
()
{
'use cache'
'use cache
: remote
'
return
fetch
(
'https://next-data-api-endpoint.vercel.app/api/random'
,
{
headers
:
{
...
...
test/e2e/app-dir/use-cache/app/(dynamic)/complex-args/page.tsx
View file @
e75fe68a
async
function
getCached
({
p
})
{
'use cache'
'use cache
: remote
'
const
array
=
await
p
if
(
array
instanceof
Uint8Array
)
{
return
array
[
0
].
toString
(
16
)
+
'-'
+
Math
.
random
()
...
...
test/e2e/app-dir/use-cache/app/(dynamic)/fetch-revalidate/page.tsx
View file @
e75fe68a
import
React
from
'react'
async
function
getData
()
{
'use cache'
'use cache
: remote
'
return
fetch
(
'https://next-data-api-endpoint.vercel.app/api/random'
,
{
next
:
{
revalidate
:
0
},
...
...
test/e2e/app-dir/use-cache/app/(dynamic)/generate-metadata/cached-data.ts
View file @
e75fe68a
import
{
setTimeout
}
from
'timers/promises'
export
async
function
getCachedData
()
{
'use cache'
'use cache
: remote
'
await
setTimeout
(
1000
)
return
new
Date
().
toISOString
()
}
test/e2e/app-dir/use-cache/app/(dynamic)/generate-metadata/page.tsx
View file @
e75fe68a
...
...
@@ -4,7 +4,7 @@ import { getCachedData } from './cached-data'
export
async
function
generateMetadata
():
Promise
<
Metadata
>
{
// TODO: Deduping with nested caches requires #78703.
// 'use cache'
// 'use cache
: remote
'
await
connection
()
...
...
test/e2e/app-dir/use-cache/app/(dynamic)/page.tsx
View file @
e75fe68a
import
{
Foo
}
from
'../client'
async
function
getCachedRandom
(
x
:
number
,
children
:
React
.
ReactNode
)
{
'use cache'
'use cache
: remote
'
return
{
x
,
y
:
Math
.
random
(),
...
...
test/e2e/app-dir/use-cache/app/(dynamic)/revalidate-and-redirect/page.tsx
View file @
e75fe68a
...
...
@@ -4,7 +4,7 @@ import Link from 'next/link'
import
{
connection
}
from
'next/server'
async
function
getCachedValue
()
{
'use cache'
'use cache
: remote
'
cacheTag
(
'revalidate-and-redirect'
)
return
Math
.
random
()
...
...
test/e2e/app-dir/use-cache/app/(dynamic)/revalidate-and-use/page.tsx
View file @
e75fe68a
...
...
@@ -9,7 +9,7 @@ async function fetchCachedValue() {
}
async
function
getCachedValue
()
{
'use cache'
'use cache
: remote
'
unstable_cacheTag
(
'revalidate-and-use'
)
return
Math
.
random
()
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/[id]/page.tsx
View file @
e75fe68a
import
{
unstable_cacheLife
}
from
'next/cache'
async
function
getCachedRandom
(
n
:
number
)
{
'use cache'
'use cache
: remote
'
unstable_cacheLife
(
'weeks'
)
return
String
(
Math
.
ceil
(
Math
.
random
()
*
n
))
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/api/route.ts
View file @
e75fe68a
import
{
unstable_cacheTag
}
from
'next/cache'
async
function
getCachedRandom
()
{
'use cache'
'use cache
: remote
'
unstable_cacheTag
(
'api'
)
return
Math
.
random
()
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/cache-fetch-no-store/page.tsx
View file @
e75fe68a
import
React
from
'react'
async
function
getData
()
{
'use cache'
'use cache
: remote
'
return
fetch
(
'https://next-data-api-endpoint.vercel.app/api/random?no-store'
,
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/cache-fetch/page.tsx
View file @
e75fe68a
import
React
from
'react'
async
function
getData
()
{
'use cache'
'use cache
: remote
'
return
fetch
(
'https://next-data-api-endpoint.vercel.app/api/random'
).
then
(
(
res
)
=>
res
.
text
()
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/cache-life/page.tsx
View file @
e75fe68a
import
{
unstable_cacheLife
as
cacheLife
}
from
'next/cache'
async
function
getCachedRandom
()
{
'use cache'
'use cache
: remote
'
cacheLife
(
'frequent'
)
return
Math
.
random
()
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/cache-tag/page.tsx
View file @
e75fe68a
...
...
@@ -9,7 +9,7 @@ async function getCachedWithTag({
tag
:
string
fetchCache
?:
'force'
|
'revalidate'
})
{
'use cache'
'use cache
: remote
'
cacheTag
(
tag
,
'c'
)
// If `force-cache` or `revalidate` is used for the fetch call, it creates
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/draft-mode/[mode]/page.tsx
View file @
e75fe68a
...
...
@@ -5,7 +5,7 @@ async function getCachedValue(
iterable
:
Iterable
<
number
>
,
fn
:
()
=>
string
):
Promise
<
[
string
,
()
=>
string
]
>
{
'use cache'
'use cache
: remote
'
// Make sure we're always receiving the arguments the same way, regardless of
// whether draft mode is enabled or not. We're asserting that by checking
...
...
@@ -27,13 +27,13 @@ export default async function Page({
}:
{
params
:
Promise
<
{
mode
:
string
}
>
})
{
'use cache'
'use cache
: remote
'
const
{
mode
}
=
await
params
const
offset
=
1000
const
cachedClosure
=
async
()
=>
{
'use cache'
'use cache
: remote
'
return
new
Date
(
Date
.
now
()
+
offset
).
toISOString
()
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/form/page.tsx
View file @
e75fe68a
...
...
@@ -6,7 +6,7 @@ async function refresh() {
}
export
default
async
function
Page
()
{
'use cache'
'use cache
: remote
'
cacheTag
(
'home'
)
return
(
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/imported-from-client/cached.ts
View file @
e75fe68a
'use cache'
'use cache
: remote
'
function
getRandomValue
()
{
const
v
=
Math
.
random
()
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/logs/page.tsx
View file @
e75fe68a
async
function
Bar
()
{
'use cache'
'use cache
: remote
'
const
date
=
new
Date
().
toLocaleTimeString
()
console
.
log
(
'deep inside'
,
date
)
return
<
p
>
{
date
}
</
p
>
}
async
function
Foo
()
{
'use cache'
'use cache
: remote
'
console
.
log
(
'inside'
)
return
<
Bar
/>
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/method-props/cached.ts
View file @
e75fe68a
export
function
createCached
(
n
:
number
)
{
return
{
async
getRandomValue
()
{
'use cache'
'use cache
: remote
'
const
v
=
n
+
Math
.
random
()
console
.
log
(
v
)
return
v
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/nested-in-unstable-cache/page.tsx
View file @
e75fe68a
import
{
revalidatePath
,
unstable_cache
}
from
'next/cache'
async
function
inner
()
{
'use cache'
'use cache
: remote
'
return
Math
.
random
()
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/not-found/page.tsx
View file @
e75fe68a
'use cache'
'use cache
: remote
'
import
{
notFound
}
from
'next/navigation'
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/on-demand-revalidate/page.tsx
View file @
e75fe68a
...
...
@@ -2,7 +2,7 @@ import { revalidatePath } from 'next/cache'
import
{
RevalidateButtons
}
from
'./revalidate-buttons'
async
function
cachedValue
()
{
'use cache'
'use cache
: remote
'
return
Math
.
random
()
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/passed-to-client/page.tsx
View file @
e75fe68a
...
...
@@ -11,15 +11,15 @@ export default function Page() {
return
(
<
Form
foo=
{
async
function
fooNamed
()
{
'use cache'
'use cache
: remote
'
return
offset
+
getRandomValue
()
}
}
bar=
{
async
function
()
{
'use cache'
'use cache
: remote
'
return
offset
+
getRandomValue
()
}
}
baz=
{
async
()
=>
{
'use cache'
'use cache
: remote
'
return
offset
+
getRandomValue
()
}
}
/>
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/rdc/page.tsx
View file @
e75fe68a
...
...
@@ -2,17 +2,17 @@ import { connection } from 'next/server'
import
{
Suspense
}
from
'react'
async
function
outermost
(
id
:
string
)
{
'use cache'
'use cache
: remote
'
return
id
+
middle
(
'middle'
)
}
async
function
middle
(
id
:
string
)
{
'use cache'
'use cache
: remote
'
return
id
+
innermost
(
'inner'
)
}
async
function
innermost
(
id
:
string
)
{
'use cache'
'use cache
: remote
'
return
id
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/react-cache/page.tsx
View file @
e75fe68a
...
...
@@ -10,7 +10,7 @@ function Component() {
}
async
function
getCachedComponent
()
{
'use cache'
'use cache
: remote
'
return
(
<
div
>
<
p
id=
"a"
>
{
number
()
}
</
p
>
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/referential-equality/page.tsx
View file @
e75fe68a
/* eslint-disable no-self-compare */
async
function
getObject
(
arg
:
unknown
)
{
'use cache'
'use cache
: remote
'
return
{
arg
}
}
async
function
getObjectWithBoundArgs
(
arg
:
unknown
)
{
async
function
getCachedObject
()
{
'use cache'
'use cache
: remote
'
return
{
arg
}
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/rsc-payload/page.tsx
View file @
e75fe68a
import
{
ClientComponent
}
from
'./client'
async
function
getLargeObject
()
{
'use cache'
'use cache
: remote
'
return
{
hello
:
'world'
}
}
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/static-class-method/cached.ts
View file @
e75fe68a
export
class
Cached
{
static
async
getRandomValue
()
{
'use cache'
'use cache
: remote
'
const
v
=
Math
.
random
()
console
.
log
(
v
)
return
v
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/use-action-state/cached.ts
View file @
e75fe68a
'use cache'
'use cache
: remote
'
export
async
function
getRandomValue
()
{
const
v
=
Math
.
random
()
...
...
test/e2e/app-dir/use-cache/app/(partially-static)/with-server-action/page.tsx
View file @
e75fe68a
...
...
@@ -7,7 +7,7 @@ async function action() {
}
export
default
async
function
Page
()
{
'use cache'
'use cache
: remote
'
return
(
<
Form
action=
{
action
}
>
...
...
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