Just do all dispatches async: setting the flag obviously does not work for more than 2 nested dispatches.
parent
b8dd2452db
commit
27ca7b48f7
|
@ -20,13 +20,11 @@ var flux = require("flux");
|
||||||
|
|
||||||
class MatrixDispatcher extends flux.Dispatcher {
|
class MatrixDispatcher extends flux.Dispatcher {
|
||||||
dispatch(payload) {
|
dispatch(payload) {
|
||||||
if (this.dispatching) {
|
// We always set a timeout to do this: The flux dispatcher complains
|
||||||
setTimeout(super.dispatch.bind(this, payload), 0);
|
// if you dispatch from within a dispatch, so rather than action
|
||||||
} else {
|
// handlers having to worry about not calling anything that might
|
||||||
this.dispatching = true;
|
// then dispatch, we just do dispatches asynchronously.
|
||||||
super.dispatch(payload);
|
setTimeout(super.dispatch.bind(this, payload), 0);
|
||||||
this.dispatching = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue