mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This updates to no longer skip caching POST or authed requests with the fetch cache and instead we bail when `cookies()` or `headers()` is used prior which is a better heuristic to signal user specific data would be related to the fetch request. x-ref: [slack thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1678130069138849) ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
20 lines
378 B
JavaScript
20 lines
378 B
JavaScript
export const revalidate = 3
|
|
|
|
export default async function Page() {
|
|
const data = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random',
|
|
{
|
|
headers: {
|
|
cookie: 'authorized=true',
|
|
},
|
|
}
|
|
).then((res) => res.text())
|
|
|
|
return (
|
|
<>
|
|
<p id="page">/variable-revalidate/cookie</p>
|
|
<p id="page-data">{data}</p>
|
|
</>
|
|
)
|
|
}
|