-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Inconsistent behavior between dev and prod for link href #1568
Comments
Hey, thanks a lot for the careful reproduction @damianfrizzi! Issue 1Ough, that was a tricky one to diagnose. I found that there's an upstream bug in Next.js that's causing this: vercel/next.js#73085. I think I can add a workaround in I'll see if CI is happy and will have another look at this early next week to make sure the workaround doesn't have any unforeseen consequences. If this issue is urgent for you, you can use Issue 2That's probably because you're using a wrong env param here: domain: process.env.NEXT_PUBLIC_VERCEL_ENV ?? 'localhost:3000' See the docs for Related to this, see using |
Thanks @amannn for your quick investigation and solution 🙏 Regarding issue 2, I do indeed have the wrong env 🤦 I guess I messed that up when creating the minimal repro (as it does work correctly on my main project). I look forward to testing your fix when it comes out in a new version! I also have slight hopes that it might also fix another issue I found in the same demo (reported here vercel/next.js#73013). |
Sure, happy to help! 🙂
Hmm, interesting, I haven't encountered that one so far. There's one mention on |
@damianfrizzi Ok, the fix looks good to me! I've tried out the just-released Can you try the fix out in your app? Thanks for the great reproduction! |
Oh I think my condition was a bit too strict, I can also reproduce it here: https://next-revalidate-bug.vercel.app/fr/. The culprit is when a non-default locale is used and the page renders on the server (navigating on the client side avoids the issue). Should be a quick fix, will follow up shortly! |
Ok, this should be fixed in Can you try out the canary release in your app? If everything looks good, I'll release this to stable. |
Just updated the repro to the canary release and it looks good now 🎉 |
Great! Does it also work correctly in your actual app now? |
Just tested and it also works in my actual app 👍 Side note: Before your fixes, the default locale was never in the href's and now it is. I.e. it now behaves according to the special case described here. |
That sounds good, thanks! |
Oh wow, just received the notification about your sponsoring—thank you so so much, I really appreciate it @damianfrizzi! ❤️ |
Description
The
href
generated by the next-intl Link component is not consistent between dev and prod and produces wrong href results.My next.config contains
trailingSlash: true
which might causes some issues.Verifications
Mandatory reproduction URL
https://next-revalidate-bug.vercel.app/
Reproduction description
Source code
To reproduce issue 1
href
of the "FR" link under "Client Component"/fr/de-ch/
instead of/fr/
bun run build && bun run start
and when deployed to VercelTo reproduce issue 2
href
of the "DE" link under "Client Component" or "Server Component"/de/
even though this is the default locale and shouldn't be shown with the locale prefix modeas-needed
Expected behaviour
as-needed
should never be part of the hrefThe text was updated successfully, but these errors were encountered: