mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
This ensures that `export const dynamic = 'force-static'` is properly
honored when a page contains fetches with `cache: 'no-store'`, `cache:
'no-cache'` or `next: { revalidate: 0 }`.
Closes NEXT-1858
37 lines
812 B
JavaScript
37 lines
812 B
JavaScript
export const dynamic = 'force-static'
|
|
|
|
export default async function Page() {
|
|
const data = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random?page',
|
|
{
|
|
cache: 'no-store',
|
|
}
|
|
).then((res) => res.text())
|
|
|
|
const data2 = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random?page',
|
|
{
|
|
next: {
|
|
revalidate: 0,
|
|
},
|
|
}
|
|
).then((res) => res.text())
|
|
|
|
const data3 = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random?page',
|
|
{
|
|
cache: 'no-cache',
|
|
}
|
|
).then((res) => res.text())
|
|
|
|
return (
|
|
<>
|
|
<p id="page">/force-static-fetch-no-store</p>
|
|
<p id="page-data">{data}</p>
|
|
<p id="page-data2">{data2}</p>
|
|
<p id="page-data3">{data3}</p>
|
|
<p id="now">{Date.now()}</p>
|
|
</>
|
|
)
|
|
}
|