mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
9c053332cc
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.
31 lines
908 B
JavaScript
31 lines
908 B
JavaScript
import { LinkAccordion } from './components/link-accordion'
|
|
|
|
export default function HomePage() {
|
|
return (
|
|
<>
|
|
<p id="home-page">Home Page [prefetch-sentinel]</p>
|
|
<LinkAccordion href="/dashboard" id="to-dashboard">
|
|
To Dashboard
|
|
</LinkAccordion>
|
|
<LinkAccordion href="/static-page" id="to-static-page">
|
|
To Static Page
|
|
</LinkAccordion>
|
|
<LinkAccordion
|
|
href="/static-page-no-prefetch"
|
|
id="to-static-page-no-prefetch"
|
|
>
|
|
To Static Page No Prefetch
|
|
</LinkAccordion>
|
|
<LinkAccordion href="/dynamic-page" id="to-dynamic-page-no-params">
|
|
To Dynamic Page
|
|
</LinkAccordion>
|
|
<LinkAccordion href="/prefetch-auto/foobar" id="to-dynamic-page">
|
|
To Dynamic Slug Page
|
|
</LinkAccordion>
|
|
<a href="/static-page" id="to-static-page-hard">
|
|
Hard Nav to Static Page
|
|
</a>
|
|
</>
|
|
)
|
|
}
|