-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request]: Aborting queries #50
Comments
Hi, There exists the concept of cancelling subscriptions. Subscriptions are given an id (for the purposes of cancellation) so I think a similar mechanism could work for queries. I think it would be up to your application to keep track of what query ids belong to which tag, as you've described it above - I don't think that belongs in re-graph. Would also have to make sure it would work for the clj implementation as well. |
Note that the query will almost certainly have been received on the server so the effect would really be to ignore the response which could be achieved without actually cancelling the HTTP request. |
Cancelling http request would also have advantage of not receiving data from the server (which might be nice in case of many requests and slow connection). But ok I guess this can be closed then? |
Hi, The 'cancel-query' could be implemented so I'm happy to keep this open for that, if it would be any use? |
yes it would. thanks. |
and deduplicating inflight queries/mutations with the same id ids are randomly generated if missing Paves the way for #50
Hi, I implemented this a while ago but haven't gotten around to writing the docs yet, however it is quite straightforward, see 81e877f - you need to give your queries ids: (re-frame/dispatch [::re-graph/query
12345
"{ things { id } }"
{:some "variable"}
[::on-thing]])
(re-frame/dispatch [::re-graph/abort 12345]) Could you try it in Many thanks |
Hi. Thanks. I've tried with websockets turned off. First I fixed compilation (nenadalm@c79d0a8 - cljs-http doesn't have |
Hi, Thanks for the compilation fix, I have integrated that into master now. I think we may need a test harness with either a real GraphQL server or by seeing if we can stub out cljs-http sufficiently to test this - I think I've implemented it properly unless you can see anything glaringly obvious, otherwise I'm not sure how else to proceed. |
And also on clojars |
Thanks. I intend to take another look at this but it might take a while - should be this month. |
It seems that r0man/cljs-http#46 is why I can't abort requests. |
Hi. It would be nice if I was able to abort query, e.g. if user changes page before previous one was fully loaded.
I found that the http library seems to support that, but there is no access to the channels from re-graph: https://github.com/r0man/cljs-http/blob/235d45d889f93d3ea79fba772d243eaa122806cc/src/cljs_http/core.cljs#L11
Maybe If I could somehow tag the query and then was able to cancel all queries tagged with the tag?
The text was updated successfully, but these errors were encountered: