Skip to content

Can we use batch with createAsyncThunk to dispatch multiple actions alongside the fulfilled action? #719

@calvinwyoung

Description

@calvinwyoung

Suppose I have a thunk created with createAsyncThunk, and due to various implementation constraints, that thunk must dispatch multiple actions during execution.

In order to reduce the number of re-renders, I can use react-redux's batch() API to dispatch all intermediate actions in a single render update. However, once the thunk returns, it will also dispatch a .fulfilled action, which will trigger another render.

Is there a way to include the .fulfilled action in the same batch() as the intermediate actions such that the entire async thunk will trigger only a single render update?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions