goatslacker / alt

Isomorphic flux implementation
http://alt.js.org/
3.45k stars 322 forks source link

"Cannot dispatch in the middle of a dispatch." when call action in componentDidUpdate #679

Closed tuwhoo closed 7 years ago

tuwhoo commented 8 years ago

I try to call action in componentDidUpdate, but it falls with error Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.. If I add setTimeout in call of this action - it works correctly. I use alt 0.16.10

yankouskia commented 8 years ago

+1

tuwhoo commented 7 years ago

Sorry for disturbing. I found that solution was described before in this issue and looks like

const alt = new Alt({
    batchingFunction: ReactDOM.unstable_batchedUpdates
});

More info I found here, here and here