mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? Using `revalidateTag` or `revalidatePath` in a route handler will not currently opt the handler into dynamic behavior. This means that if you use these APIs and don't opt into dynamic behavior by some other means, the revalidation call won't do anything as the route handler will be served statically. ### Why? During static generation, we do not currently indicate that usage of these APIs should opt into dynamic usage. ### How? This updates `revalidateTag` to throw a `DynamicUsageError` (similar to our other scenarios, such as search params bailout, headers/cookies, or fetch + revalidate/no-store) Closes NEXT-1712
18 lines
309 B
JavaScript
18 lines
309 B
JavaScript
export default async function Page() {
|
|
const data = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random',
|
|
{
|
|
next: {
|
|
tags: ['thankyounext'],
|
|
},
|
|
}
|
|
).then((res) => res.text())
|
|
|
|
return (
|
|
<>
|
|
Data:
|
|
<div id="data-value">{data}</div>
|
|
</>
|
|
)
|
|
}
|