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
Reactivity broken after redirecting from a plugin (nuxt generate) #737
Comments
Please create repro test case. For example on codesandbox |
done |
Thanks. I can reproduce. It does look like a core Nuxt issue though. I can probably manage to reproduce it without nuxt-i18n. Something to do with redirecting page early during loading. |
I should be able to fix it though. |
This does not only happen with page title; it also happens in other places (e.g. the menu). See example: https://thejewelleryroom.com - try to get your locale to be "danish", you should be redirected to https://thejewelleryroom.com/da but page content is still english, and so is the menu. |
Could you recommend any workaround @rchl untill this is fixed? |
I'm looking into it. |
When we've detected browser language and need to redirect we need to do it from the middleware for the page to transition correctly. The problem is Nuxt doesn't trigger middleware for initial navigation in static mode (the idea is that it already ran when generating page on the server), so we can't do it properly. Fixed by hooking into the VueRouter "beforeEach" navigation hook so that we can handle it from the right place. Still, as Nuxt doesn't know that we are redirecting, it would throw some errors trying to load previous page. So use "location.assign()" to "hard" redirect. Resolves #737
When we've detected browser language and need to redirect we need to do it from the middleware for the page to transition correctly. The problem is Nuxt doesn't trigger middleware for initial navigation in static mode (the idea is that it already ran when generating page on the server), so we can't do it properly. Fixed by hooking into the VueRouter "beforeEach" navigation hook so that we can handle it from the right place. Still, as Nuxt doesn't know that we are redirecting, it would throw some errors trying to load previous page. So use "location.assign()" to "hard" redirect. Resolves #737
When we've detected browser language and need to redirect we need to do it from the middleware for the page to transition correctly. The problem is Nuxt doesn't trigger middleware for initial navigation in static mode (the idea is that it already ran when generating page on the server), so we can't do it properly. Fixed by hooking into the VueRouter "beforeEach" navigation hook so that we can handle it from the right place. Still, as Nuxt doesn't know that we are redirecting, it would throw some errors trying to load previous page. So use "location.assign()" to "hard" redirect. Resolves #737
When we've detected browser language and need to redirect we need to do it from the middleware for the page to transition correctly. The problem is Nuxt doesn't trigger middleware for initial navigation in static mode (the idea is that it already ran when generating page on the server), so we can't do it properly. Fixed by hooking into the VueRouter "beforeEach" navigation hook so that we can handle it from the right place. Still, as Nuxt doesn't know that we are redirecting, it would throw some errors trying to load previous page. So use "location.assign()" to "hard" redirect. Resolves #737
@simplenotezy Are you able to beta test the fix for me?
It has some potential to change behavior as it uses Fix only affects static mode on the client and only the initial navigation. |
On it |
Seems to do the trick, see https://thejewelleryroom.com However, I just found this bug: #717 |
When we've detected browser language and need to redirect we need to do it from the middleware for the page to transition correctly. The problem is Nuxt doesn't trigger middleware for initial navigation in static mode (the idea is that it already ran when generating page on the server), so we can't do it properly. Fixed by hooking into the VueRouter "beforeEach" navigation hook so that we can handle it from the right place. Still, as Nuxt doesn't know that we are redirecting, it would throw some errors trying to load previous page. So use "location.assign()" to "hard" redirect. Resolves #737
The fix was released and #717 is hopefully also addressed so closing this one. |
Hello,
after redirection happens, the page is translated successfully, but the head content doesn't change (title, meta description ... etc)
the problem is only when using nuxt generate (using Netlify).
Locally, it works, title changes.
reproduce the issue:
1- open website from a browser with default language french:
https://tender-raman-68344c.netlify.app/
2- the url will be (
https://tender-raman-68344c.netlify.app/fr
) and the body content will be ("francais") till now everything is ok... but page title remains ("english") 😞code is here:
https://codesandbox.io/s/github/SherifGhoz/redirection-issue
https://github.com/SherifGhoz/redirection-issue
Is there any solution ?
The text was updated successfully, but these errors were encountered: