Skip to content

How to cancel an AJAX request? #1482

Answered by kitten
albertcito asked this question in Q&A
Discussion options

You must be logged in to vote

Just to add a response to this, it's not recommendable to have a GraphQL mutation that's cancellable and instead rely on a multistep solution.
The most common one here is to have a separate upload URL.

This has multiple reasons. The first is that GraphQL mutations aren't cancellable and in urql, they're hence also not cancellable.

While it's possible to make them cancellable and cancelling HTTP requests is normal, and does happen for subscriptions and queries, for mutations the situation is different.

Although there's nothing stopping you from cancelling mutations that run via HTTP there's no guarantee that the remote API will respond to this, mutation or not. There's basically no guarant…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by albertcito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants