Fix issue with dispatch happening mid-dispatch due to js-sdk emit (#8473)

This commit is contained in:
Michael Telatynski 2022-05-03 15:02:55 +01:00 committed by GitHub
parent dc9ec8526c
commit a88112a37a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);