@inttegro/cogni-tanstack-router wraps TanStack Router’s awaitable preloadRoute() contract in a
familiar link. Route parameters, search state, active state, and ordinary anchor props stay with the
router; Cogni owns whether predictive work starts.
This guide follows the
0.1 API and TanStack Router 1.x. Confirm the latest published version and
migration notes before installing a newer 0.x release.Replace Link
preload behavior, then calls
router.preloadRoute() after Cogni admits the candidate. The returned promise keeps the prediction
in its loading state until TanStack’s speculative match lane settles.
When TanStack begins a matching navigation, the adapter attributes reuse. If the user leaves,
prevents the event, opens another context, or navigates elsewhere, the prediction is not credited.
Keep router cache policy
Cogni does not replacepreloadStaleTime, preloadGcTime, route loaders, or an external query
cache. Those settings decide whether the route can reuse settled work. Cogni decides whether the
speculation was worth starting and measures whether committed navigation used it.
Avoid enabling a second default preload strategy for these links. PredictiveLink passes
preload={false} internally so hover does not bypass Cogni’s budget.
Use predictionKey, policy, cost, priority, and estimatedBytes when the default route
identity needs more context. Cogni starts with its conservative probability and 30 second reuse
horizon, then learns from actual reuse and waste. Override either value when the application has
stronger evidence.
See React for provider ownership and Scheduling and intent for
the admission sequence.