mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
The result of certain kinds of prefetches may depend on the current URL
at the time it is initiated. This is true if for links that are
intercepted, or links that are prefetched using a dynamic request (e.g.
`prefetch={true}`). So, whenever the location changes, we should
re-prefetch all the links using the updated value.
In most cases, this will not result in any new network requests — only
if the prefetch result actually varies on one of these inputs.
For similar reasons, we also re-prefetch links whenever the client cache
is revalidated by a Server Action.
As part of the implementation, we must be able to enumerate over all the
currently visible links. I've added a Set to track this.
16 lines
309 B
TypeScript
16 lines
309 B
TypeScript
import { connection } from 'next/server'
|
|
import { Suspense } from 'react'
|
|
|
|
async function Content() {
|
|
await connection()
|
|
return <div id="page-a-content">Page A content</div>
|
|
}
|
|
|
|
export default async function PageA() {
|
|
return (
|
|
<Suspense fallback="Loading...">
|
|
<Content />
|
|
</Suspense>
|
|
)
|
|
}
|