-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Minimal reproduction of the bug/regression with instructions:
^v8.0.0 https://stackblitz.com/edit/angular-8-getting-started-1koz3g
^v10.0.0 https://stackblitz.com/edit/angular-ivy-bf2jo8
Expected behavior:
Not an infinite loop, instead a simple navigation cancel resulting in a white-screen.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):
@ngrx/platform: v8.6.0
@angular/core: v8.0.0
Other information:
This exists in develop as well, but I simply made a repro on the version of Angular in which I found the bug.
The bug is a result of two things:
- A guard on the root that utilizes state for its observable emission.
- A race-condition here..
The router-store code, which is quite old (pre-ngrx 4), assumes that state reduction follows IMMEDIATELY after an action is dispatched. Yet, this isn't always the case, given that actions are stacked onto an rxjs queue. This means that when this check occurs the trigger value is RouterTrigger.NONE instead of RouterTrigger.ROUTER which results in an infinite loop as it triggers another navigation to the root re-checking the guard.
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