Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ntziolis opened this issue Jun 30, 2024 · 0 comments
Open

Comments

@ntziolis
Copy link
Contributor

ntziolis commented Jun 30, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant