mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Ensures this method works in pages the same as in app as discussed. x-ref: [slack thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1683242040712889) x-ref: [slack thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1683724596461329)
30 lines
480 B
JavaScript
30 lines
480 B
JavaScript
import { unstable_cache } from 'next/cache'
|
|
|
|
export const config = {
|
|
runtime: 'experimental-edge',
|
|
}
|
|
|
|
export async function getServerSideProps() {
|
|
const data = await unstable_cache(async () => {
|
|
return {
|
|
random: Math.random(),
|
|
}
|
|
})()
|
|
|
|
return {
|
|
props: {
|
|
now: Date.now(),
|
|
data,
|
|
},
|
|
}
|
|
}
|
|
|
|
export default function Page(props) {
|
|
return (
|
|
<>
|
|
<p>/unstable-cache-edge</p>
|
|
<p id="props">{JSON.stringify(props)}</p>
|
|
</>
|
|
)
|
|
}
|