Examples · Data & cache

Prefetch on hover

Warm the cache when the cursor slows down over a link.

The request starts on intent, not on click. prefetchOn() watches hover (with a fly-by detector), tap or visibility and warms the same cache the resource reads from, so the detail view opens with no spinner.

Playground

What to notice

  • Hover a name for a moment before clicking: the GET appears in Server requests before the click.
  • The detail resource uses cache: true, so the prefetched entry is found by key.
  • Save-Data and 2g connections turn prefetch off automatically.

Compare: click a name immediately vs. hover first.