mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Reverts https://github.com/vercel/next.js/pull/38070 I stumbled upon @ijjk's TODO to remove the deprecated `unstable_revalidate` renaming error and e2e test after v12.2. ```tsx // TODO: remove in next minor (current v12.2) ``` I also removed the deprecated function stub, since it probably shouldn't exist if there's no error, e2e test, and doesn't match the new `revalidate` function signature anyways. <img width="675" alt="image" src="https://user-images.githubusercontent.com/14317828/202842660-be9977e2-252c-4ccf-84fc-e0c00bf25e05.png">
17 lines
402 B
JavaScript
17 lines
402 B
JavaScript
export default async function handler(req, res) {
|
|
// WARNING: don't use user input in production
|
|
// make sure to use trusted value for revalidating
|
|
let revalidated = false
|
|
try {
|
|
await res.revalidate(req.query.pathname, {
|
|
unstable_onlyGenerated: !!req.query.onlyGenerated,
|
|
})
|
|
revalidated = true
|
|
} catch (err) {
|
|
console.error(err)
|
|
}
|
|
res.json({
|
|
revalidated,
|
|
})
|
|
}
|