Store change (container render) is still inside a dispatch
Klaasvaak opened this issue · 0 comments
I got the following error in my webapp:
Uncaught Error: Invariant Violation: Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.
While debugging this I noticed that a render, triggered by a store change, is still within a dispatch. Is this as it should work? The problem here is that when rendering nested AltContainers and fetching data in the compomentWillMount hooks with an action this will cause: Uncaught Error: Invariant Violation: Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.
I changed altSetState to use a nextTick. But I'm not sure if that is the way to go. But it does fix the error.
For now I will defer my actions called in all compomentWillMount hooks within an AltContainer.
Does this make sense?