mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This ensures we properly honor the `export const fetchCache` config and also ensures we properly bypass fetch-cache when an On-Demand Revalidation is occurring. The `export const dynamic` handling is not changed here as that was behaving correctly and should not influence fetch cache handling only whether a page is prerendered fully or treated as SSR. Fixes: https://github.com/vercel/next.js/issues/47273 x-ref: [slack thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1679078572123979)
10 lines
285 B
JavaScript
10 lines
285 B
JavaScript
export default async function handler(req, res) {
|
|
try {
|
|
await res.revalidate(req.query.path)
|
|
return res.json({ revalidated: true, now: Date.now() })
|
|
} catch (err) {
|
|
console.error('Failed to revalidate', req.query, err)
|
|
return res.json({ revalidated: false })
|
|
}
|
|
}
|