-
-
Notifications
You must be signed in to change notification settings - Fork 5k
fix(router-link): active class with encoded params #3125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR but this the fix shouldn't change how URLs are generated. The encoded version should be the one generated. The problem is the other way around: when the page is reloaded, the fullPath
property is decoded (/user/tést) instead of being encoded (/user/t%C3%A9st) like it usually is when doing $router.push({ name: 'special', params: { test: 'tést' }})
Regarding the difference between named routes and string-based push like $router.push('/url')
and $router.push({ path: '/url' })
: when doing string-based push, the user is responsible for encoding the urls but when doing others, the router should encode params for you. That's why the two router-link you added in the e2e test yield different results. But it's expected
You can change things in this pr if you want to or close it and start a new one
If I understood correctly, then I, as a user, should encode the string in the fallen test.
|
@Alexeykhr I updated the original issue at #3103 Going to an unencoded URL is not valid, so it doesn't matter if the active link matches or not, but when visiting the encoded valid url, it should match the link |
I will try to fix this :). Closes #3103
The problem is url generation. We have 2 routes:
In the first case, the route is transmitted as it is. In the second - it is decoded through the library:
path-to-regexp
(in new versions this can be changed by parameter)Before:

After:

But, if it works in History Mode. Then for Hash Mode you need to edit separately, because there the same problem exists.
Somewhere here