Files
next.js/test/e2e/app-dir/use-cache/app/(partially-static)/rdc/page.tsx
Josh StoryandGitHub 8cab15c0c9 [Cache Components] Remove unstable prefix from unstable_cacheLife (#84877)
`cacheLife` is now stable and does not require an unstable prefix
2025-10-15 08:14:04 -07:00

52 lines
829 B
TypeScript

import { cacheLife } from 'next/cache'
import { connection } from 'next/server'
import { Suspense } from 'react'
async function outermost(id: string) {
'use cache'
return id + middle('middle')
}
async function middle(id: string) {
'use cache'
return id + innermost('inner')
}
async function innermost(id: string) {
'use cache'
return id
}
async function Short({ id }: { id: string }) {
'use cache'
cacheLife('seconds')
return id
}
async function Dynamic() {
await connection()
return null
}
async function CachedStuff() {
await outermost('outer')
await innermost('inner')
return (
<Suspense>
<Short id="short" />
</Suspense>
)
}
export default function Page() {
return (
<div>
<CachedStuff />
<Suspense>
<Dynamic />
</Suspense>
</div>
)
}