Skip to content

Store change (container render) is still inside a dispatch #5

Description

@Klaasvaak

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions