Skip to content

Is there a way to abort a get request manually? #1416

Answered by phryneas
arjunvegda asked this question in Q&A
Discussion options

You must be logged in to vote

In theory you might be able to call

const running = trigger()
runninc.cancel()

but I'm not 100% sure.

We have general cancellation support in RTKQ, but it is not really part of types and documentation because it is very unclear what would happen after cancellation from a developer experience side - the request would go into a weird "error" state. This needs more fleshing out.

Generally in most cases it does not make a difference though: cancelling does not stop most servers from actually processing it and if you're not interested in the result, it could also just be ignored. Your very-long-running-request here seems to be quite the difference from that "normal case" 🤔

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@arjunvegda
Comment options

Answer selected by arjunvegda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants