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

t3chguy/dedup-icons-17oct
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
1 changed files with 2 additions and 1 deletions

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