You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After changing language code in the URL the root route's redirectTo value is set incorrectly to the previously used value. This results in problems with triggering router.navigate(['/'])
The actual value of the route object:
{ path: "", redirectTo: "fr", pathMatch: "full" }
Desired value of the route object after changing language in the URL:
{ path: "", redirectTo: "en", pathMatch: "full" }
Reproducing the issue
I used the demo app included on the master branch to reproduce the issue. Inside app.component.ts I added a simple console.log() printing out router config like:
Description
After changing language code in the URL the root route's
redirectTo
value is set incorrectly to the previously used value. This results in problems with triggeringrouter.navigate(['/'])
The actual value of the route object:
Desired value of the route object after changing language in the URL:
Reproducing the issue
I used the demo app included on the master branch to reproduce the issue. Inside
app.component.ts
I added a simple console.log() printing out router config like:Steps to reproduce
/en/
->/fr/
or/fr/
->/en/
Possible solution
I believe the issue is caused by the following piece of code inside
localize-router.parser.ts
:Since
this.defaultLang
doesn't takelocationLang
into consideration. The likely solution would be to change this bit of code to:I'd appreciate any feedback in case I got something wrong in this whole testing problem :)
The text was updated successfully, but these errors were encountered: