You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Just do all dispatches async: setting the flag obviously does not work for more than 2 nested dispatches.
This commit is contained in:
@@ -20,13 +20,11 @@ var flux = require("flux");
|
||||
|
||||
class MatrixDispatcher extends flux.Dispatcher {
|
||||
dispatch(payload) {
|
||||
if (this.dispatching) {
|
||||
setTimeout(super.dispatch.bind(this, payload), 0);
|
||||
} else {
|
||||
this.dispatching = true;
|
||||
super.dispatch(payload);
|
||||
this.dispatching = false;
|
||||
}
|
||||
// We always set a timeout to do this: The flux dispatcher complains
|
||||
// if you dispatch from within a dispatch, so rather than action
|
||||
// handlers having to worry about not calling anything that might
|
||||
// then dispatch, we just do dispatches asynchronously.
|
||||
setTimeout(super.dispatch.bind(this, payload), 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user