Platform: @ngrx/router-store triggers unexpected ROUTER_CANCEL action if store is modified by guard .

Created on 3 Oct 2017  路  5Comments  路  Source: ngrx/platform

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request

What is the current behavior?

If the store is asynchronously modified by route guard, during the transition StoreRouterConnectingModule is executing navigateByUrl on router, because the url set in state by StoreRouterConnectingModule (taken from NavigationStart event) is different than router.url value (which contains url from before of transition). This cause cancellation of previous navigation, and next try to execute the navigation (for same url), and again and again, until the guard will not return true synchronously.

Please look at code https://github.com/ngrx/platform/blob/master/modules/router-store/src/router_store_module.ts#L209

Expected behavior:

StoreRouterConnectingModule should not trigger navigateByUrl if state is modified by guard.

Minimal reproduction of the problem with instructions:

Please look at: http://plnkr.co/edit/SbecXWSzFMnSRA9JFQ0i

Version of affected browser(s),operating system(s), npm, node and ngrx:

latest

Other information:

Needs Reproduction Router Store bug

Most helpful comment

I keep getting this error even with new master.

All 5 comments

Can you make a small repro?

This issue has already been fixed in master and will be in the next release. https://github.com/ngrx/platform/pull/355

When will it be released? Thanks.

I keep getting this error even with new master.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shyamal890 picture shyamal890  路  3Comments

Matmo10 picture Matmo10  路  3Comments

oxiumio picture oxiumio  路  3Comments

gperdomor picture gperdomor  路  3Comments

RichardMisiak picture RichardMisiak  路  3Comments