localize-router
localize-router copied to clipboard
fix issue with changeLanguage when route parameters are used
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!
any news on this PR?
Why is this not merged yet?
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
Would also love to get this fix.
any updates on when this will be merged?
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.