Closed justblender closed 2 years ago
Hello @justblender ,
I agree with this feature request, i'm going for the same way tRPC handle this (just a little better) as in tRPC their solution will override user defined signal.
So the solution is to add a a signal combinator and also an option to opt in
into this feature that is called shouldAbortOnUnmount
.
Here is how to activate it:
cons client = new Zodios(api);
const hooks = new ZodiosHooks('my api', client, { shouldAbortOnUnmount: true } );
it's now available on version v10.4.0
of @zodios/react
Wow, that was fast. Thank you!
As it currently stands, it doesn't seem like
@zodios/react
passes downsignal
provided byreact-query
's query function down toaxios
request config.react-query
doesn't enforce an opinion on whether or not you should use abort signals while handling asynchronous state, but given the fact that this library works exclusively with HTTP requests I think it makes sense to passsignal
as a sensible default or at least provide a way for users to specify whether or not queries should be cancelled.See this: https://tanstack.com/query/v4/docs/guides/query-cancellation.