-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 generated by Schematics cause 100% CPU / Frozen tab #1524
Comments
Hi @adamduren I am attempting to recreate this issue and so far haven't had any luck. Here's what I have done.
ngOnInit() {
this.store$.pipe(select(s => console.log('User', s.user)));
this.store$.dispatch(new LoadUsers());
} Are you doing something differently? |
My guess is that the schematic generates the effect: @Effect()
loadFoos$ = this.actions$.pipe(ofType(FoosActionTypes.LoadFoos)); Which causes the famous infinite loop ☠️ . In order to fix this I think we can:
But I think all these options make it more complicated for our users 🤔 |
Can confirm.... Adding I vote for creating the effect class with the constructor and then leaving off the |
I used the An alternative is to add a second action However, I'm open for whatever is clear and fixes the behavior. |
It's got me a few times and I'm always initially stumped for why my tab gets the spinner of doom. |
I'd prefer to leave the effect in the class and comment it out. Its easier to delete the code, or uncomment it rather than having to add it. Slightly related to #1529 also. |
After upgrading to 7.x (from 6.x) , I have exactly the same problem |
How was this not the case in 6.x? Generating a feature does not dispatch the newly created action, and if you dispatch that action before doing anything with the effect you will get caught in a loop. |
Minimal reproduction of the bug/regression with instructions:
This is because in the generated module the generated action is dispatched. The effects listen for that dispatched action however does not filter the action so it gets dispatched as a result of passing through the effects.
Expected behavior:
Dispatch loop does not occur.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):
Other information:
I would be willing to submit a PR to fix this issue
[ X ] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
The text was updated successfully, but these errors were encountered: