Skip to content

Commit

Permalink
Fix issue with dispatch happening mid-dispatch due to js-sdk emit (#8473
Browse files Browse the repository at this point in the history
)
  • Loading branch information
t3chguy authored May 3, 2022
1 parent dc9ec85 commit a88112a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/actions/MatrixActionCreators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ function addMatrixClientListener(
const listener: Listener = (...args) => {
const payload = actionCreator(matrixClient, ...args);
if (payload) {
dis.dispatch(payload, true);
// Consumers shouldn't have to worry about calling js-sdk methods mid-dispatch, so make this dispatch async
dis.dispatch(payload, false);
}
};
matrixClient.on(eventName, listener);
Expand Down

0 comments on commit a88112a

Please sign in to comment.