react-apollo-hooks icon indicating copy to clipboard operation
react-apollo-hooks copied to clipboard

useLazyQuery ignores request if one is in progress (or how to cancel running requests)

Open dominictobias opened this issue 5 years ago • 0 comments

Hi,

I'm using useLazyQuery for a user lookup for suggestions, so it's important that requests aren't missed.

The default behaviour it seems is that requests are ignored if one is happening - I would like to cancel running requests and fire the new one.

At the moment if I type "Dominic Tobiaz" and then correct it to "Dominic Tobias", the request will be ignored if the misspelled one is still running.

The useLazyQuery request function sadly is not returning the fetch Promise for me to be able to cancel, nor have I had any luck with fetchPolicy: 'network-only'.

Thanks for any help!

dominictobias avatar Sep 13 '19 15:09 dominictobias