Skip to content

How to properly abort a pending fetch request? #2749

Answered by kitten
schnz asked this question in Q&A
Discussion options

You must be logged in to vote

There are three different cases here, and I'll ignore the specific framework bindings (like the bindings for React, for instance):

  • Running a query declaratively (e.g. via useQuery or client.query)
  • Running a query imperatively (e.g. via client.query(...).toPromise())
  • Running a mutation

In the first case, whenever the subscription to the result disappears, e.g. useQuery is unmounted, then the Client will issue a teardown event and ensure that ongoing requests are cancelled and notify the cache that you're not interested in any further updates.

However, in the second case, once you basically use the promisifying request, or are using the Wonka streams and aren't unsubscribing, the result w…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@kubijo
Comment options

@kitten
Comment options

@kubijo
Comment options

Answer selected by JoviDeCroock
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants