question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Function traverseSnapshot not properly assembling the new translated route.

See original GitHub issue

I’m submitting a … (check one with “x”)

[ x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if similar feature request does not exist
[ ] support request => Suggested place for help and support is [stackoverflow](https://stackoverflow.com/), search for similar question before posting

Description

Using angular 7+ if a route as parameters, for example :name or :id, this method on this line “…Object.keys(snapshot.params).length ? [snapshot.params] : [],” will add to the route the following “;name=valueofthename” or “;id=valueoftheid”. There is another problem on the line above on the urlPart this urlPart I think needs to be splited by “/” otherwise if my route is something like “person/:name” the the result of calling the method changeLanguage that calls the traverseSnapshot will result in something like “lang/person%2Fvalueofthename;name=valueofthename”.

🔬 Minimal Reproduction (if applicable)

On this code https://stackblitz.com/edit/localize-router-v2-issue-template-o6mvus if you write on the link “/en/hello/name” and after click on on of the buttons to change the language you will sew on the console the error “Cannot match any routes. URL Segment: ‘de/hello%2Fname;name=name’” the type of the error does not matter for the problem as it is just a not matching error, the problem is actully the construction of the url that is not properly constructed.

🌍 Your Environment

Angular Version:


Angular CLI: 7.0.5
Node: 10.13.0
OS: win32 x64
Angular: 7.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.10.5
@angular-devkit/build-angular     0.10.5
@angular-devkit/build-optimizer   0.10.5
@angular-devkit/build-webpack     0.10.5
@angular-devkit/core              7.0.5
@angular-devkit/schematics        7.0.5
@angular/cli                      7.0.5
@ngtools/webpack                  7.0.5
@schematics/angular               7.0.5
@schematics/update                0.10.5
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.19.1

Localize Router Version:


localize-router: 2.0.0-RC.2 
localize-router-http-loader: 1.0.2

Anything else relevant?


@ngx-translate/core: 11.0.1
@ngx-translate/http-loader: 4.0.0

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:11

github_iconTop GitHub Comments

3reactions
andrewwhiteheadcommented, Dec 31, 2018

I have a potential fix for this here: https://github.com/cywolf/localize-router/tree/fix-151

1reaction
JoseCMRochacommented, Feb 26, 2019

Hi @dragorwyin that is strange your case is very similar with mine and the solution by @cywolf worked for me, did you check your routing configuration to see if there is something wrong? are you able to create a example to reproduce your problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

localize-router - UNPKG
traverseSnapshot (rootSnapshot, true)\n .filter((path: string, i: number) => {\n ... 'function') {\n throw new TypeError('Provided object does not correctly ...
Read more >
Ultra_Tales_Issue_11 - Yumpu
The reroutedcourse took in a little more road than usual, but therunners were able to keep their feet dry (well, theirthighs dry at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found