Files
Zack TannerandGitHub cc92654396 fix app router prefetch deduping (#68642)
The `Link` component has built in prefetch deduping behavior that was
added for pages router, since pages only supports a single kind of
prefetch.

Both pages & app routers share the `Link` component, meaning the
deduping behavior was enabled for both. However, app router supports
different [prefetch
types](https://nextjs.org/docs/app/api-reference/components/link#prefetch).
This means that if a page contains a link to a URL with auto
prefetching, followed by a URL with `prefetch={true}`, the full prefetch
would not be applied because it was short-circuited by `Link`.

Closes NDX-124
2024-08-07 18:35:34 -07:00

20 lines
410 B
JavaScript

import Link from 'next/link'
import React from 'react'
export default function Page() {
return (
<>
<div>
<Link href="/force-dynamic/test-page">
/force-dynamic/test-page (prefetch: auto)
</Link>
</div>
<div>
<Link href="/force-dynamic/test-page" prefetch>
/force-dynamic/test-page (prefetch: true)
</Link>
</div>
</>
)
}