Skip to content
Snippets Groups Projects
Commit 27ca7b48 authored by David Baker's avatar David Baker
Browse files

Just do all dispatches async: setting the flag obviously does not work for...

Just do all dispatches async: setting the flag obviously does not work for more than 2 nested dispatches.
parent b8dd2452
No related merge requests found
...@@ -20,13 +20,11 @@ var flux = require("flux"); ...@@ -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
// 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); setTimeout(super.dispatch.bind(this, payload), 0);
} else {
this.dispatching = true;
super.dispatch(payload);
this.dispatching = false;
}
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment