-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Make it possible to abort requests #3
Comments
This is an interesting question. There is the capability in cljs-ajax and goog.XhrIO to abort requests, the question is how to do this with re-frame. One possibility is that users specify an additional
This is an interesting idea which could simplify some kinds of code, like debouncing search results. |
Yeah, purely for debouncing I often have code like this:
Which is easy to wrap in an effect handler. But I suspect there's a more general case, as I'll often want to kill off slow requests when navigating. There's even perhaps a wider (re-frame) point that currently effect handlers aren't that extensible, because they expose no data themselves - in this case it would be good to get a map out of all the current requests, so you could handle aborting requests without having to inspect or copy the actual implementation of http-fx. |
i need this functionality too, and for me would be better to have something like |
@danielcompton what do you think? can i make a PR? |
I just came here looking for the same reason. I have some very long running queries, and currently I manually build the requests for those using the re-frame-http-fx plumbing (just so it looks the same). I'm refactoring and wanted things to be consistent and hit the two spots where I use My gut says @flexsurfer's The dispatcher can then decide what to do with the raw request, save it in the |
Hi. I was thinking about it and maybe two additional keys could be added to the event?
Ideally when event is in progress and I could send pr if this is acceptable. |
It's common to want to abort an in-progress HTTP request, perhaps if a more recent request comes along (for example the case of multiple autocomplete requests), or if the user navigates away and it is no longer relevant.
How might I go about holding on to handlers (perhaps in
:db
) so that I can later handle them? Or would it be better to have an API that allowed a programmer to specify some sort of identifier for each request, such that multiple requests with the same identifier caused the previous one to abort?The text was updated successfully, but these errors were encountered: