-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Locale goes back when clicking on nextjs Link component #293
Comments
Do you reproduce the issue when running locally? AFAIK this is a bug with CodeSandbox, they don't preserve cookies correctly. |
@QuiiBz Thanks for the response! Yes it also does the same behavior in my local environment. But I also noticed that this problem is related to the cookies. The thing is my current
The reason why I added So basically I want to know if there is a way to handle user can type and dynamically change the locale & route to the correct path from URL bar without above if statement in the middleware.ts? |
Ok so finally I could manage the cookies correctly via
With this, the cookies should be always align with the current locale. But I found that I still have to explicitly tell nextjs Link component to include locale prefix in the href, otherwise it always navigates me to the pure href link even we include the locale props like below. For example we are in: http://localhost:3000/jp/admin/settings/
After click the Link component, it navigates me to the And of course if we specify the locale prefix like, it works correctly and keeps the cookie fine as well.
Am I missing something? |
I'm not able to reproduce the issue using the example in the repo: https://github.com/QuiiBz/next-international/tree/main/examples/next-app The steps I did:
Does this work on your side, and if no could share the steps to reproduce in this example above? CodeSandbox has issues with cookies so that's why I'd like to reproduce outside of it. |
Hello @QuiiBz I experiment an issue which could be related to this one. To reproduce:
Source code: Maybe this is due to my middlewares chain? Btw: I also cheat one rewrite in my middleware, without having any issue about it. |
Describe the bug
Maybe related to #138 & #140, when I click nextjs
<Link>
component, it forces to go back to the default locale.To Reproduce
Steps to reproduce the behavior:
en
->fr
Link component
en
even we pass the locale prop in theExpected behavior
Should keep the locale
About (please complete the following information):
The text was updated successfully, but these errors were encountered: