mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Refactors some older prefetching tests to be compatible with `clientSegmentCache`. The old tests were too tightly coupled to router implementation details. Some of the ones that don't make sense to convert were removed (for ex, asserting on prefetch cache seeding behavior, or fetch priority of "high", as fetch priority is managed differently with the new router). This refactors the tests to leverage the `act` util from `segment-cache` test suites, and implemented the accordion behavior to more granularly control when prefetches are dispatched. I copied those implementations for now since we don't have a global util for it.
23 lines
491 B
JavaScript
23 lines
491 B
JavaScript
import Link from 'next/link'
|
|
|
|
export const revalidate = 0
|
|
|
|
async function getData() {
|
|
await new Promise((resolve) => setTimeout(resolve, 3000))
|
|
return {
|
|
message: 'Welcome to the dashboard',
|
|
}
|
|
}
|
|
export default async function DashboardPage(props) {
|
|
const { message } = await getData()
|
|
|
|
return (
|
|
<>
|
|
<p id="dashboard-page">{message} [dashboard-prefetch-sentinel]</p>
|
|
<Link href="/static-page" id="to-static-page">
|
|
To Static Page
|
|
</Link>
|
|
</>
|
|
)
|
|
}
|