TanStackT
TanStack3y ago
2 replies
hurt-tomato

Cancel paused queries on component unmount

Use case : I go to a screen A while offline and then come back to previous screen B. When I come online I don't want fetch for screen A to happen in background.

Basically, I want to cancel a query if the component in which it is present is unmounted.

Passing signal in axios.get to cancel query works but only for idle queries. But for paused query it doesn't stop network request.

Is there a way to even cancel paused queries ?

Note : This post has been edited.
Was this page helpful?