vuejs / apollo

🚀 Apollo/GraphQL integration for VueJS
http://apollo.vuejs.org
MIT License
6.03k stars 522 forks source link

Abort pending request #969

Open igaloly opened 4 years ago

igaloly commented 4 years ago

The problem There's no ability to cancel/abort a request that is pending and hasn't resolved yet

Use case

Possible solutions https://github.com/apollographql/apollo-feature-requests/issues/40#issuecomment-554561836 Works, but

https://github.com/apollographql/apollo-client/issues/4150#issuecomment-500127694 Works, but

Thoughts It seems like the first solution is much more suitable, but a good abstraction should be implemented

Akryum commented 4 years ago

vue-apollo doesn't handle making requests, it's apollo-client itself.

igaloly commented 4 years ago

I understand. But there is already such a capability implemented by apollo-client. The problem is that there's no appropriate abstraction for this in vue-apollo's side. We need to be able to the get the queryId of a pending query by its name ( or any other way ), and a method such as 'stopQuery' that'll get the id and will kill it.

igaloly commented 4 years ago

@Akryum Also, what do you think about the implementation of canceling pending requests when the component destroyed?