localize-router icon indicating copy to clipboard operation
localize-router copied to clipboard

fix issue with changeLanguage when route parameters are used

Open hohler opened this issue 5 years ago • 6 comments

PR Checklist

Please check if your PR fulfills the following requirements:

  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [x] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Other... Please describe:

What is the current behavior?

Issue Number: #151

(copied from issue) 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".

What is the new behavior?

It will correctly assemble the route when changing the language and using route params.

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

This is now an issue for over 3 months and nothing happened. I'm using this fix in production for this time and nothing broke. I think we are save to merge this PR without adding new tests.

Credits to cywolf (https://github.com/cywolf) for the fix!

hohler avatar Mar 19 '19 10:03 hohler

any news on this PR?

giacomo avatar Apr 18 '19 09:04 giacomo

Why is this not merged yet?

omnibrain avatar Jun 05 '19 14:06 omnibrain

For all that are waiting for a release you can use: patch-package to patch your application (https://www.npmjs.com/package/patch-package).

Attached the patch: unpack it and copy to patch folder localize-router+2.0.0-RC.2.patch.zip

giacomo avatar Jun 12 '19 15:06 giacomo

Would also love to get this fix.

hanneskaljuste avatar Oct 30 '19 15:10 hanneskaljuste

any updates on when this will be merged?

pixelatorz avatar Dec 27 '19 14:12 pixelatorz

This bug is still present in v1.0.0-rc.3 and this fix cannot be directly applied.

@meeroslav do you plan to fix this issue? It is quite a bug, as any real world application has route parameters.

ntopulos avatar Mar 19 '20 17:03 ntopulos