-
Notifications
You must be signed in to change notification settings - Fork 87
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
[Bug]: App Directory: Navigation between pages is always hard reload #2089
Comments
There seemed to be change somewhere between |
Is there anything I can help with? |
This is happening to me in Next 13.4.2 |
Same here, waiting for updates... |
Edit: only in |
I thought it was an issue with Styled Components and ended up rewriting a lot of components only to figure out that wasn't the issue. I'm deploying on Netlify, using Nextjs |
How to use |
@edarioq after deployment it turned out that If anyone has a similar problem, they can take a look at vercel/next.js#48728 |
I'm also experiencing the same issue. See here for a sample project. Switching to vercel for now as that solves the problem for me. |
Note that on the issue I just linked someone suggested that it might possibly be related to this |
Tested with
The issue still exists. My usecases:
The above happens when using |
I have the same problem, all my Next Link made a full refresh on page. |
Hey @kamalbennani. |
I have the same problem. Any solution? |
Same issue |
I have moved our sites to Vercel... they seem to not have a single issue, also their free tier is enough for our needs for now. So not only am I saving money, everything works as it should. |
nextjs document is also very confusing. in their documentation they have mentioned that if you have multiple root layouts then it will cause full reload. then i again reverted the code and again added the layout files in all the routed and deployed the code in Vercel and everything was working absolutely fine and navigation between Links were not causing full reload of page. What i found is same application is working fine in verce but not working in netlify. I think Netlify is not much compatible for NextJS deployment as of now. same application in 2 different platformnetlify: www.rahulnag.in |
Hey, I was having same issue. The only difference was that I started my project using the T3 Stack. Above @pieh says that the problem started on v.13.3.0, so my first solution (that might help you) was to downgrade Next.js to v.12.0.0 and deployed to Vercel for testing. Vercel throws and error saying that I needed to set ** There's another option, but I think is exclusive for apps created using
So I removed My
|
I might do the same tomorrow. |
Unfortunately we also had to move our website to Vercel because of this issue. I understand that it is actually Next.js (made by Vercel) patching React and creating lots of edge cases, and Vercel probably doesn't want to prioritize fixing an issue that makes people move over to their platform. Just wanted to let you know that more people experience this problem, and that it's unfortunate as our team would love to be able to continue using Netlify. |
I am using 14.1.0 in a site and it still has the issue. If I change the root layout to 'use client' then it resolves but I can't generate the metadata for it though. |
9 months have passed, yet there has been no progress made on this issue. Given the lack of attention it has received, It seems that the Netlify development team may not be prioritizing this matter at all. |
I am using next: 14.1.0 and @netlify/plugin-nextjs: "^4.41.3" and also running into this issue, any workarounds or should i downgrade both versions? |
I am also facing the same issue with Firebase hosting, We are using the Next: 14.1.0 version. Our static pages reload each time, but dynamic routes work fine. |
really strange. netlify hasn't fixed this issue even after so many complaints. |
I am have issue with this as well. I am on Next.js 14 and I have a website theme selector option using React useContext. On my local dev and environment it keeps the theme selection persistent when I navigate to a new page. When website is deployed on Netlify there is a hard load when navigating to new page and resets the state variables to default. It doesn't remember the theme selection. I have tried Next.js Production mode on my local and it works as it should. It if definitely a Netlify problem. Does this mean apps where we need to keep state across pages are not compatible? What should we do? |
Hope it would be fixed soon |
Its not netlify issue i deployed in fargate it doesn't work where as in local prod mode and vercel it works |
has anyone had the chance to try it with the newer 5.0.0 beta version of plugin-nextjs. |
also happens on github pages deploy using app router, any next/link clicked will work fine going FROM "/", but going TO "/" hard refreshes and you lost any context provider context |
Stll waiting to know the work around |
I'm using shallow routing to update the searchParams. When i update the searchparams the page reloads on Netlify. On the local build it doesn't reload the page. Could this be the same issue? |
UPDATE: Netlify released the Next.js Runtime v5 earlier this week which you can opt-in through the Deploys page of your Netlify app or manually. Updating to the Next.js V5 runtime resolved the shallow routing problem I was having and reported in this long thread. Cc: @MarcL |
yippee... finally working.. this issue resolved after upgrading to next js runtime 5. Just two steps. click on on Opt in and deploy the site again. |
Yes, it's working. Netlify has recently updated a runtime Thanks to Netlify ✨ |
still... nextjs sucks |
Spent hours trying to figure this out until I stumbled on this thread. Yes nextjs kinda sucks, but even so, it still took Netlify over 8 months to fix. which I think is completely unacceptable for functionality that's so absolutely basic. Guess it's time to start exploring other hosting for clients' sites. |
having this problem in vercel right now, nextjs updated |
same problem, when I navigate between pages, the page is always reloaded |
I solved the issue for me by using |
Well regardless if this issue was fix or not, I have already move my project Vercel, where everything works the way it should. |
I solved this issue by using Link tag |
Hey all. The team at Netlify have now released the new You can find the documentation and additional information on the The Thanks! |
While navigating to another page using a link, the page is reloading in Next.js 13 and Next.js 14. Please let me know how to resolve this. |
Use |
Summary
When using App Directory (App Router) in Next.js (to clarify: the problem exists from the first version with app router to current version 13.4.1) every navigation using a link performs a hard reload, instead of expected behavior of refreshing only navigated part of the app (eg. inner page without layout).
Problem occurs on all Next.js versions with App Router and probably all Next.js Plugin versions (I tested this on 4.33.0, 4.30.1, appdir and current latest version).
I'm not the only one with this problem; this problem is already on Next.js 13 App Router Feedback discussion, but it looks like everyone forget that that discussion exists: #1724 (comment)
I reported this problem on Netlify Support forums first: https://answers.netlify.com/t/next-js-13-app-directory-hard-reload-on-navigation/89143, where I shared some network requests info (note that this info is from an old Next.js and plugin version):
When opening /, Next.js also makes requests to links on this page with header RSC: 1 and receives some data (it’s even cached for me). As I understand RSC files are used to make redirects without hard reloads or something.
When clicking on a link to /buy, it first makes the same request again, then makes request to /buy, but now without RSC: 1 so it receives HTML. Then requests are almost the same as on / but for /buy now.
On next js dev server requests go this way:
When opening /, no requests are made with RSC header, only if I hover over a link.
When clicking a link it makes request to /buy with RSC, then to page.js (http://localhost:3000/_next/static/chunks/app/buy/page.js) and that’s all (excluding TRPC request, but that is not related to navigation)
By the way, it also didn’t work on Vercel, but that was because I didn’t remove i18n from my next config. After that, there was no hard reloads on Vercel but on Netlify nothing changed.
Examples so you can test it for yourself:
Deployed on Vercel (working as intended): https://adt.vercel.app/
Deployed on Netlify (latest plugin version, performs hard reload on navigation): https://famous-fox-e34d2e.netlify.app/
The link to test with is "Link" text in top-right corner.
Steps to reproduce
Use the provided examples:
Deployed on Vercel (working as intended): https://adt.vercel.app/
Deployed on Netlify (latest plugin version, performs hard reload on navigation): https://famous-fox-e34d2e.netlify.app/
The link to test with is "Link" text in top-right corner.
OR
Create it for yourself:
(or clone my repo: https://github.com/molniya0207/adt)
A link to a reproduction repository
https://github.com/molniya0207/adt
Next Runtime version
4.36.0
Is your issue related to the
app
directory (beta)?app
directoryMore information about your build
netlify.toml
)What OS are you using?
None
Your netlify.toml file
No response
Your public/_redirects file
No response
Your
next.config.js
file`next.config.js`
Builds logs (or link to your logs)
Build logs
Function logs
Function logs
Nothing useful:
.next JSON files
No response
The text was updated successfully, but these errors were encountered: