Answer the question
In order to leave comments, you need to log in
How do you solve Flux's "Cannot dispatch in the middle of a dispatch" problem?
Good afternoon/evening,
Colleagues, please tell me how you solve the problem of Flux async?
By chance, I came across this solution:
import Flux from "flux";
const AppDispatcher = new Flux.Dispatcher();
AppDispatcher.deferDispatch = function( value ) {
if( AppDispatcher.isDispatching() == true ) {
setTimeout( () => AppDispatcher.dispatch( value ), 0 );
} else AppDispatcher.dispatch( value );
}
export default AppDispatcher ;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question