Skip to content

Rework subscription handling to batch "need to subscribe but entry exists" behavior #2593

@markerikson

Description

@markerikson

We've had several folks report that rendering a long list of components with RTKQ hooks can be very slow. My suspicion is that it's because we dispatch separate "need to subscribe" actions for every component. The first component will fetch the data and create the cache entry. All other components will see the cache entry exists, dispatch a rejected action, and the subscription logic handles that to add another subscription.

Additionally, as components unsubscribe, there's a lot of timer cancelation and resetting going on.

I think we need to figure out how to batch the "cache entry exists but need to subscribe" behavior into some debounced batched actions to cut down on the overhead. We may also need to tweak the unsubscribe handling as well to cut down on timer manipulation.

Don't have a performance capture atm - I should set up an example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions