Skip to content

Effects directive only unregisters last effect for each effect provider #72

@ntziolis

Description

@ntziolis

Which @ngneat/effects-* package(s) are the source of the bug?

effects-ng

Is this a regression?

No

Description

Effects directive only unregisters last effect for each effect provider. The other effects keep running even after the component with the directive are destroyed.

The below uses the instance as the key, which results in each additional effect in the loop overriding the last entry.

this.sourceInstancesWithProvidersEffectsTokens.set(

During unregister sourceInstancesWithProvidersEffectsTokens is used to identify which effects to unregister. While there might be multiple providers in the set, there is always only one effect entry associated with each provider.

...this.sourceInstancesWithProvidersEffectsTokens.entries(),

Please provide a link to a minimal reproduction of the bug

This can be reproduced by adding additional effects to the effect providers in the unit tests.

Please provide the exception or error you saw

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

Not sure if I understand the codebase enough to ensure I don't brake the other feature "an effect will always only run once"

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