-
Notifications
You must be signed in to change notification settings - Fork 144
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
Add client side abort for request.js #370
Conversation
Looking forward to seeing this merged! Causing some headaches for my team right now. |
@wmdmark happy to check this out, but I really could use a little context on what issues this will resolve for your team. Would you mind sharing? It would be most appreciated! |
@dustinlarimer having the ability to cancel a pending ajax request is useful thing to expose on it's own but the particular area where it's causing problems for us is the following scenario:
Let me know if you need any more details than that. |
@wmdmark first off, it sounds like you're building something awesome! I do agree that exposing an We've encountered the same issue in our own apps, and have found this sort of pub/sub model to work much better. Asynchronous actions update a data store, which then emits a change event, affecting only the mounted+subscribed components. How does that sound? Do you think this would be a useful pattern in your project? |
@dustinlarimer we do use a flux-like pattern for most things in our app but we'd like the |
@wmdmark totally understand! The request object that componentDidMount: function(){
this.req = client.run(query);
this.req.on('complete', this.handleResponse);
},
componentWillUnmount: function(){
this.req.off('complete');
} Do you think that might do the trick? This won't abort the XHR request, but may prevent the error that's holding you up. I do agree that an |
@dustinlarimer Yep, that solution does work for us! Thanks for your help! |
@wmdmark Awesome, I'm relieved to hear that! Sorry for the speed-bump! If you hit any other critical issues and need to chat, just give me a shout at dustin@keen.io. |
@wmdmark If we can get this PR synced with master and updated to use The difference in method names may seem trivial, but keen-analysis.js promises are powered by bluebird, which exposes a |
Add client side abort function for request.js
(this does not abort severside call.)
fix #365