Skip to content

Store listening to actions after dismount #547

@Chayemor

Description

@Chayemor

I have two store and two components that use the stores (one store per component). The use case implies navigating from one component to the other through a link. In the components I have the following line after getting a WARNING about not calling "setState" when component is unmounted (looking through this forum gave me the answer for that):

componentWillUnmount() { Reflux.Component.prototype.componentWillUnmount.call(this); ... }

My question is in regards to the unmounted store still listening to Actions. So I wanted a single action called loadData to be listened to in both stores. Each store does a different thing based on that action. This action is called by the components on their respective componentDidMount methods. The thing is, when I navigate from one component to the other, when the action loadData gets called, both stores listen to it instead of only the one that was just attached to the component that in turned triggered loadData.

I suppose my question is, am I not supposed to use generic actions like that? I assumed if the stores did not have any mounted components that used them, they wouldn't listen to the actions.

Thank you.

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