-
-
Notifications
You must be signed in to change notification settings - Fork 4
fix: switch locale path loses query parameters #46
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
fix: switch locale path loses query parameters #46
Conversation
|
This PR is what broke the copying of the route: nuxt/nuxt#21957 |
|
Thanks! Oh, I forgot to update intlify/bridging deps... 😅 |
| return result | ||
| } | ||
|
|
||
| export function routeToObject(route: Route | RouteLocationNormalizedLoaded) { |
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.
Below is your Description on this PR:
Does not work for @nuxtjs/i18n or maybe it is a Nuxt related issue, I noticed that the route object was a proxy and accessing each property did work. So I added a function to destructure each property by name instead of using a spread operator.
Unfortunately I don't know why the behaviour is like this, and I don't think I can add tests for this case as it may be Nuxt related.
Let’s write the comment !, so maintainer can understand the background when we read this code.
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.
I have added a short description now, hopefully it is informative enough.
kazupon
left a comment
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.
I've just reviewed your PR.
Please check out!
|
One more thing, I've fixed e2e errors at #47 |
4b40f44 to
015a6d1
Compare
Description
For some reason
switchLocalePathis not working as expected in@nuxtjs/i18n, after debugging it seems like spreading the route here:https://github.com/intlify/routing/blob/main/packages/vue-i18n-routing/src/compatibles/routing.ts#L301-L305
Does not work for
@nuxtjs/i18nor maybe it is a Nuxt related issue, I noticed that therouteobject was a proxy and accessing each property did work. So I added a function to destructure each property by name instead of using a spread operator.Unfortunately I don't know why the behaviour is like this, and I don't think I can add tests for this case as it may be Nuxt related.
This should resolve nuxt-modules/i18n#2354
Linked Issues
nuxt-modules/i18n#2354
Additional context