Files
JJ KasperandGitHub a1633948ad Add warning for edge with force-static (#50182)
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)
2023-05-22 20:54:15 +00:00

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>
</>
)
}