mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Currently the edge runtime does not support static generation so this adds a warning when `force-static` is leveraged with `edge-runtime` as it will cause unexpected behavior. Support is being investigated so this isn't a hard error at the moment. x-ref: [slack thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1684783403551589)
23 lines
560 B
JavaScript
23 lines
560 B
JavaScript
import { cache, use } from 'react'
|
|
|
|
export const runtime = 'experimental-edge'
|
|
export const dynamic = 'force-static'
|
|
|
|
export default function Page() {
|
|
const getData = cache(() =>
|
|
fetch('https://next-data-api-endpoint.vercel.app/api/random?page', {
|
|
next: { revalidate: 3 },
|
|
}).then((res) => res.text())
|
|
)
|
|
const dataPromise = getData()
|
|
const data = use(dataPromise)
|
|
|
|
return (
|
|
<>
|
|
<p id="page">/variable-revalidate/revalidate-3</p>
|
|
<p id="page-data">revalidate 3: {data}</p>
|
|
<p id="now">{Date.now()}</p>
|
|
</>
|
|
)
|
|
}
|