Skip to main content
Start with one route whose reuse you can prove. A likely Products navigation begins one bounded read, writes to the foreground cache, and reports whether navigation consumed it.
This guide follows the 0.1 API. Confirm the latest published version and migration notes before installing a newer 0.x release.

Find the cache

First identify where ordinary navigation reads this data. Prediction must populate that exact place. Here, a Map represents the router or query cache, and one key identifies an account’s first Products page. You need:
  • A TypeScript application with fetch and AbortController.
  • A read-only endpoint or router prefetch function.
  • A host-owned cache that ordinary navigation already consumes.
  • A stable key that includes every tenant and input dimension needed to identify one reusable representation.

Create the coordinator

Create one coordinator for the application scope so candidates share a concurrency and queue budget:
openProducts() calls markReused() only after reading the predicted cache entry. The coordinator controls the loader lifecycle but never owns ProductsPage. The ordinary fetch remains available after a miss or failure.

Inspect outcomes

Every handle exposes a terminal completion promise, and the coordinator keeps bounded quality history:
After loading, the prediction remains in waiting_for_reuse until the host calls markReused() or the horizon expires. Material work that reaches the horizon without reuse becomes missed. Work reported with materialWork: false represents an already-warm host cache and stays outside the material reuse denominator.

Dispose cleanly

Call dispose() when the application shell that owns the coordinator is destroyed:
Disposal rejects new work and aborts active loaders. Pass the loader’s signal into cancellable I/O.

Continue