mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Updates handling for app dir caching for edge runtime and adds additional tests. x-ref: NEXT-511 Co-authored-by: JJ Kasper <[email protected]>
22 lines
508 B
JavaScript
22 lines
508 B
JavaScript
import { cache, use } from 'react'
|
|
|
|
export const runtime = 'experimental-edge'
|
|
|
|
export default function Page() {
|
|
const getData = cache(() =>
|
|
fetch('https://next-data-api-endpoint.vercel.app/api/random?page', {
|
|
cache: 'no-store',
|
|
}).then((res) => res.text())
|
|
)
|
|
const dataPromise = getData()
|
|
const data = use(dataPromise)
|
|
|
|
return (
|
|
<>
|
|
<p id="page">/variable-revalidate/no-cache</p>
|
|
<p id="page-data">no-store: {data}</p>
|
|
<p id="now">{Date.now()}</p>
|
|
</>
|
|
)
|
|
}
|