Closed praveen5959 closed 1 month ago
Leaving it to react query wont do any harm neither does it improve performance by cancelling requests. Please remove the abort controller implementation.
AbortController seems like a cleaner approach here right. Basically it cleanly stops any overhead related to the request. If this doesn't have any overhead, why remove it?
Leaving it to react query wont do any harm neither does it improve performance by cancelling requests. Please remove the abort controller implementation.
AbortController seems like a cleaner approach here right. Basically it cleanly stops any overhead related to the request. If this doesn't have any overhead, why remove it?
@nitisht Why we shouldn't abort a network request: https://tanstack.com/query/latest/docs/framework/react/guides/query-cancellation#default-behavior - Package docs.
In addition to the above ^, We have an abort controller in place for GRPC requests from the console. But for these rest API calls, the backend will still process the call even if we abort.
react-query will internally cancel the queries. React Query will stop handling the response from the previous query, but it doesn't automatically cancel the underlying network request.
To explicitly cancel the request over network. I had to use
AbortController
(or AxioscancelToken
) to cancel the pending requests over network to save bandwidthcc: @balaji-jr