-
Notifications
You must be signed in to change notification settings - Fork 406
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
🐞[BUG]: Actions triggered Twice #2277
Comments
@Squixx The only think I can think is that you are possibly adding a state twice and therefore the handlers are being registered twice. |
@markwhitfeld you are 100% right, there was a provideStore() implementation somewhere hidden in a submodule. However this was working correctly on 18.1.5 (we've been running like this for +3 months). I guess it's not as much 'broken' per se, but it is really unintuitive. If you were to do something about this, my opinion would be that it should break when adding the state twice, but actually throwing somewhere so you'll have some way of pinpointing the error. Thanks for your pointer, would have taken me a way longer time to find this otherwise. |
In case it helps for others searching for similar issues, we were seeing this behavior because we were using |
Thanks for this issue and answers ! We had the same problem, we used a forRoot (we should migrate to provideStore and provideStates) on a feature and some actions were dispatched twice since 18.1.16 |
Affected Package
@ngxs/store 18.1.6
Is this a regression?
Yes, this was working fine on 18.1.5
Description
When I update to 18.1.6 within our repo all my actions seem to be triggered twice. When debbugging i can see the dispatch function is only called once, but the action method executes twice. (if the first action within the action is a console log i'll also see this in my logs
🔬 Minimal Reproduction
I haven't yet been able to reproduce this outside of our repo. But one thing to note is: it is still module based. We're using (lazy loaded) for feature modules, and it happens both when using provideStore([state]) and ngxsmodule.forRoot([state]), forFeature() or provideStates([])
If i can provide a smaller reproduction I'll update this.
Environment
The text was updated successfully, but these errors were encountered: