mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
When you're using `noStore()` with `fetch` it's currently saying "auto cache" in cache missed reason, adding "noStore call" here to show it's caused by using with `unstable_noStore` ``` GET /no-store 200 in 4069ms │ GET https://next-data-api-endpoint.vercel.app/api/random?another-no-cache 200 in 257ms (cache: SKIP) │ │ Cache missed reason: (noStore call) ``` Closes NEXT-2097
22 lines
537 B
JavaScript
22 lines
537 B
JavaScript
import { unstable_noStore } from 'next/cache'
|
|
|
|
async function getUncachedRandomData() {
|
|
unstable_noStore()
|
|
const res = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random?another-no-cache'
|
|
)
|
|
const data = await res.json()
|
|
return data
|
|
}
|
|
|
|
export default async function Page() {
|
|
const uncachedData = await getUncachedRandomData()
|
|
console.log('uncachedData', uncachedData)
|
|
return (
|
|
<div>
|
|
<p>random: {Math.random()}</p>
|
|
<p id="uncached-data">uncachedData: {uncachedData}</p>
|
|
</div>
|
|
)
|
|
}
|