Files
JJ KasperandGitHub ce746ef5c2 Handle unstable_cache in pages (#49624)
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)
2023-05-10 13:59:48 -07:00

26 lines
421 B
JavaScript

import { unstable_cache } from 'next/cache'
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-node</p>
<p id="props">{JSON.stringify(props)}</p>
</>
)
}