From a88112a37a7ac30ba97b0c6061f8996b0eb5c631 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 3 May 2022 15:02:55 +0100 Subject: [PATCH] Fix issue with dispatch happening mid-dispatch due to js-sdk emit (#8473) --- src/actions/MatrixActionCreators.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/actions/MatrixActionCreators.ts b/src/actions/MatrixActionCreators.ts index c4d75cc854..b889376336 100644 --- a/src/actions/MatrixActionCreators.ts +++ b/src/actions/MatrixActionCreators.ts @@ -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);