Repository navigation
fix(router): child CanActivate guard should wait for parent to complete - #15672
DzmitryShylovich wants to merge 1 commit into
Conversation
|
LGTM, could you please add a test |
|
@vicb added a test. I'm afraid in this case I can't avoid playing with timings. |
|
@DzmitryShylovich I ran into the bug that this changeset is attempting to solve and I can confirm that this change does force the guards to activate in the correct order. However, this change seems to also cause a more subtle error to occur. I have a guard defined that in the case of an error is supposed to navigate to the root of my application. Before making the change from mergeMap to concatMap the navigation on error seems to work fine. Unfortunately after swapping out the functions in the Angular source code the navigate no longer navigates back correctly. While it doesn't throw any errors, the root application page no longer renders. canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
var success = false;
var productId = route.params['productId'];
success = this.ngRedux.getState().products.find(p => p.id === productId) !== undefined;
if (success) {
this.pageActions.updatePageState({ productId: productId });
}
else {
this.router.navigate(['/']);
}
return success;
} |
|
@nrgonzalez777 can you please provide a small plunkr with the code that does work before the fix and doesn't work after? Because I can't reproduce. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Closes #15670
http://plnkr.co/edit/MY3XRClqXi2wwOWem4My?p=preview