Cancel queries
Is there an option to cancel all queries (not invalidate) and abort them? Something similar to: https://tanstack.com/query/v4/docs/react/guides/query-cancellation
Usecase:
On logout I would like to cancel all queries, show notification and then navigate to login page.
Thanks
Jörg
Query Cancellation | TanStack Query Docs
TanStack Query provides each query function with an AbortSignal instance, if it's available in your runtime environment. When a query becomes out-of-date or inactive, this signal will become aborted. This means that all queries are cancellable, and you can respond to the cancellation inside your query function if desired. The best part about th...
3 Replies
Hi @thejorge4666. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The extracts provided do not contain information about cancelling all queries on logout in refine. However, they do mention the use of
onCancel
property in mutation hooks like useUpdateMany
, useUpdate
, useDeleteMany
, and useDelete
when the mutationMode
is set to undoable
. This allows you to cancel the ongoing mutation and handle the cancellation process in your own way, such as showing a custom notification or implementing any other desired behavior to allow users to cancel the mutation.
For more detailed information, you may want to check the official refine documentation (https://refine.dev/docs) or React Query documentation (https://tanstack.com/query/v3/).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@897927276304416769> kapa.ai is still learning and improving, please let us know how it did by reacting below
exotic-emerald•11mo ago
Hello @thejorge4666, unfortunately, we don't have this feature.