T
TanStack2mo ago
fair-rose

abort async operation of prefetchQuery() on navigation

hello, im using nuxtjs with tanstack query (nuxt v3 integration) with full client side routing (no ssr). on page "/a" im prefetching a list of endpoint without await-ing to avoid blocking the rendering. now imagine a use case when user dont wait to the end of prefetching before moving from "/a" to "/a/1" the remaining prefetching will continue or no ? should i abort them manually or the lib already does it
1 Reply
dependent-tan
dependent-tan2mo ago
We only do this for observers that get unmounted if you consume the abortSignal, not for prefetches. Generally we don't know when a navigation happens so you'd need to cancel manually.

Did you find this page helpful?