Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: provide option to automatically abort requests when response is no longer needed #4618

Open
ensconced opened this issue Sep 11, 2024 · 1 comment

Comments

@ensconced
Copy link

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?

@sglogovic-moberg
Copy link

sglogovic-moberg commented Sep 12, 2024

We would use this feature as well in our apps in the similar fashion as described, so +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants