Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Living wiki of UI design patterns and best practices built with Fumadocs, Next.js, and Base UI components.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/prefetch-trajectory-over-hover.md
1---2title: Trajectory Prediction Over Hover Prefetching3impact: HIGH4tags: prefetch, trajectory, hover, performance5---67## Trajectory Prediction Over Hover Prefetching89Hover prefetching starts too late. Trajectory prediction fires while the cursor is still in motion, reclaiming 100-200ms.1011**Incorrect (waits for hover):**1213```tsx14<Link15href="/about"16onMouseEnter={() => router.prefetch("/about")}17>18About19</Link>20```2122**Correct (trajectory-based):**2324```tsx25const { elementRef } = useForesight({26callback: () => router.prefetch("/about"),27hitSlop: 20,28name: "about-link",29});3031<Link ref={elementRef} href="/about">About</Link>32```33