-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
Link
component is buggy when used in app router
#75318
Comments
I'm having a similar issue with the link component when linking to a new search param value, but my issue is that there is no navigation at all. I can see fetches happening in my network tab but no navigation is happening on the front-end. Refreshing fixes the issue, but only for that pages pagination/search param navigation. |
I have this issue. All the links work once. And then they won't navigate unless I reload the page. I'm on 15.1.6 |
I'm seeing this with all relative urls. But I have a vercel/platforms inspired middleware. I'll check if it has to do with any of that code. |
I'm on 15.2.0-canary.28 the latest canary. It's extremely frustrating that for me it only happens in production so it's hard to test workarounds. |
Trying with |
Do you guys have also a reproduction repository? I think OP's issue is somehow related to export mode, and the express server they use. Haven't had time to deep dive any more. If query params are missing and such, but only in production, does it also happen on local production builds? And, could we somehow discard other layers on the stack? |
Don't have a reproduction repo yet, but it does happen in local production builds as well. Just to reiterate the issue in my case:
|
For my case, I have two theories that I am going to try and disprove today on why this may not be a Next.js bug those being, I am using Shadcn's pagination component with I'm working on a full minimal reproduction repo to show my findings and hopefully narrow down the issue. However, I only ran into issues once I implemented a new route that also contained pagination. EDIT: I forgot to mention |
We're seeing the same issue on what I think is a pretty basic setup, the only experimental feature we have is For now we have removed query strings where we could and are waiting for a fix, if another reproduction repo is needed we can have a look at that on Monday. |
Yeah from what I found I could not re-produce the issue using Also this is one of those issues that if widespread it would be causing an uproar as almost every site uses |
Is your production project part of a larger stack? Could the issue be in those? This somewhat reminds me of the stale times issue, but I haven't really read deeply through your comments |
My production project is just a Next.js App Router project originally initialized using
|
Link to the code that reproduces this issue
https://github.com/mehulmpt/nextjs-app-router-link-bug
To Reproduce
npm run bugcheck
command in your terminalhttp://localhost:3000
Current vs. Expected behavior
Current behavior:
The links rightly point to
/link?productid=1
//link?productid=2
... and so on. However, when you click on it, they redirect you to the wrong page!Expected behavior:
Redirect works properly
Provide environment information
Which area(s) are affected? (Select all that apply)
Navigation
Which stage(s) are affected? (Select all that apply)
Other (Deployed), Vercel (Deployed), next start (local)
Additional context
I spent 20 minutes debugging this for one of our clients today and finally figured out this is a bug with Next.js itself. The reproduction code above is extremely minimal and does not include anything else other than the required code.
The behavior is very weird, the link shown is correct in the browser preview on the bottom left but the moment it is clicked, it takes you to the wrong page. I am also attaching the video that showcases it:
screenshot-000899.mp4
The text was updated successfully, but these errors were encountered: