mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What Provide `revalidateReason` in the `errorContext` argument of `onRequestError` API #### API ```ts revalidateReason?: 'on-demand' | 'stale' | undefined ``` ### Why With this property, developer is able to determine if current error is attached to an ISR request. * `stale` means it revalidated due to the cache is expired * `on-demand` means it revalidated due to a user initiated revalidation, e.g. using `res.revalidate` to revalidate certain path ### Misc * We don't generate edge entry of instrumentation when there's no edge routes but instrumentation is presented Note: for PPR case we'll tackle it later with another PPR specific task, since we need to provide the render is a postpone render or just normal render Closes NDX-23
12 lines
269 B
JavaScript
12 lines
269 B
JavaScript
export default async function handler(req, res) {
|
|
const { path } = req.query
|
|
try {
|
|
await res.revalidate(path)
|
|
return res.json({ revalidated: true })
|
|
} catch (err) {
|
|
console.error('Failed to revalidate:', err)
|
|
}
|
|
|
|
res.json({ revalidated: false })
|
|
}
|