Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Dispatch go not working in canActivate if dispatch event in ngOnInit #54

Open
antonbarada opened this issue Jun 19, 2017 · 2 comments
Open

Comments

@antonbarada
Copy link

Repo for reproduce:
https://github.com/thebarada/ngrx-router-can-activate-bug
Just try go to /profile - path will be empty
Then comment dispatch on ngOnInit in AppComponent and try one more time - path will be '/login' and it is correct

Description:
I create canActivate guard where redirect to login if user non-authorized
Also on init AppComponent I dispatch event for load some data

I suppose this two actions disturb each other and go action not working

@antonbarada
Copy link
Author

hey guys
any updates?

@bradseefeld
Copy link

We are running into a similar issue, but I think the bug may be against @angular/router, not router-store. We have replaced our dispatch(go([...])) calls with router.navigate and it still does not work.

I have found this issue which seems to be the cause, but its closed as fixed. One of the suggestions was to use {initialNavigation: false} on the RouterModule.forRoot call, which actually fixes this issue, but breaks some of our other navigation.

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

No branches or pull requests

2 participants