In some situations, the backend processing of a request can take a long time or be very expensive. In this situation it would be good to be able to automatically abort requests when the response is no longer needed, either because the component using the query has been unmounted, or because the params have changed.
I imagine this would be achieved via a new option abortRedundantRequests. If set to true on a given endpoint, this would mean that the AbortSignal (which I believe is already passed through to fetchBaseQuery) gets aborted. Then the backend can listen for the connection being closed, and stop any expensive processing it might still be doing.
Is that something that would make sense for RTK to implement? Or is there any way I can achieve this already?
In some situations, the backend processing of a request can take a long time or be very expensive. In this situation it would be good to be able to automatically abort requests when the response is no longer needed, either because the component using the query has been unmounted, or because the params have changed.
I imagine this would be achieved via a new option
abortRedundantRequests
. If set totrue
on a given endpoint, this would mean that the AbortSignal (which I believe is already passed through to fetchBaseQuery) gets aborted. Then the backend can listen for the connection being closed, and stop any expensive processing it might still be doing.Is that something that would make sense for RTK to implement? Or is there any way I can achieve this already?