mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
When a page is accessed via a rewrite, use the destination path (not the source path) when computing implicit tags. This ensures that calling `revalidatePath('/dest')` correctly invalidates cache entries for pages rewritten to that destination.
Fixes `'use cache'` and fetch cache with rewrites. ISR page cache was not affected because it already uses the rewritten pathname as the cache key (via `resolvedUrlPathname` in `base-server.ts`).
24 lines
431 B
TypeScript
24 lines
431 B
TypeScript
async function getData() {
|
|
const res = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random'
|
|
)
|
|
return res.text()
|
|
}
|
|
|
|
export default async function SharedPage({
|
|
isDynamic,
|
|
}: {
|
|
isDynamic: boolean
|
|
}) {
|
|
const data = await getData()
|
|
|
|
return (
|
|
<div>
|
|
<h1>{isDynamic ? 'Dynamic' : 'Static'} Page</h1>
|
|
<p>
|
|
Random data: <span id="random-data">{data}</span>
|
|
</p>
|
|
</div>
|
|
)
|
|
}
|