Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Question: How can I abort a query already in progress? #3663

Open
Dastari opened this issue Nov 9, 2019 · 1 comment
Open

Question: How can I abort a query already in progress? #3663

Dastari opened this issue Nov 9, 2019 · 1 comment

Comments

@Dastari
Copy link

Dastari commented Nov 9, 2019

Is there any way to abort a useQuery that is in progress?

I have a map that queries data based on the bounding coordinates of the current window. Data fetch times can be a few seconds but if the user rapidly moves around I want to be able to cancel the last request made in favor of the new query.

I do use throttling and checking the loading state of the useQuery however this just prevents new queries being executed concurrently. This is fine but it leaves me with waiting for data from the original useQuery to finish before I can do anything else.

@dylanwulf
Copy link
Contributor

useQuery is supposed to cancel the request when the component is unmounted, but this is currently broken: apollographql/apollo-client#4955

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants