Skip to content

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

Open
@ensconced

Description

@ensconced

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions