Files
Hendrik LiebauandGitHub c3d5b92778 [test] Move the dev-only use cache test suite to test/development (#96023)
The `use-cache-dev` suite only covers dev-mode HMR behavior of `use
cache`, so it belongs under `test/development/app-dir` alongside the
other `cache-components-dev-*` suites rather than in `test/e2e`. Because
`test/development` runs only in dev mode and is never deployed, the
production-mode placeholder guard, the `skipDeployment` option, and the
`if (skipped)` early return are all dropped. The three test manifests
that referenced the old path are updated.


---

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
2026-07-22 15:50:22 +02:00

46 lines
1001 B
TypeScript

import { revalidatePath } from 'next/cache'
import Link from 'next/link'
async function getRandomValue() {
'use cache'
return Math.random()
}
async function getData() {
'use cache'
return fetch('https://next-data-api-endpoint.vercel.app/api/random').then(
(res) =>
res
.text()
.then(async (text) => [text, 'foo', await getRandomValue()] as const)
)
}
export default async function Page() {
const [fetchedRandom, text, mathRandom] = await getData()
return (
<>
<div id="container">
<p id="fetchedRandom">{fetchedRandom}</p>
<p id="text">{text}</p>
<p id="mathRandom">{mathRandom}</p>
</div>
<p id="uncached">{new Date().toISOString()}</p>
<form
action={async () => {
'use server'
revalidatePath('/')
}}
>
<button id="revalidate">Revalidate</button>
</form>
<p>
<Link href="/some/path">Go to /some/path</Link>
</p>
</>
)
}