next.js/test/e2e/app-dir/use-cache-configured-timeout/app/below-dev-timeout/page.tsx
page.tsx22 lines541 B
// Cache body sleeps 11s, which falls between the build-time clamp (9s)
// and the configured dev `useCacheTimeout` (15s).
// - Dev: the cache fills successfully (15s > 11s, no clamp).
// - Build: the cache times out (clamp 9s < 11s).
async function getCachedData(): Promise<string> {
  'use cache'

  await new Promise((resolve) => setTimeout(resolve, 11_000))

  return 'cached'
}

async function Cached() {
  const data = await getCachedData()

  return <p id="result">{data}</p>
}

export default function Page() {
  return <Cached />
}
Quest for Codev2.0.0
/
SIGN IN