trojanowski / react-apollo-hooks

Use Apollo Client as React hooks
MIT License
2.41k stars 109 forks source link

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

Open sekoyo opened 5 years ago

sekoyo commented 5 years ago

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!