-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
App Router in Next v14.1.0 slower than v13.4.6 #61259
Comments
Could be related #61203 |
14.1.02024-01-29.15.04.38.mp414.0.3.canarey-7:2024-01-29.15.03.44.mp4A bug with caching routes, when hovering over next/link, the route is loaded again. Slow 3g is selected in the video, but even with fast Internet, the behavior is exactly the same. Prefetch also does not load css. It took a lot of time to figure out what the problem was. The biggest mistake is to believe that the new versions are stable. |
Related to #48748 and I believe it it related to optimizePackageImports not working properly (I'm compiling 10k+ modules per route aprox) |
Hi @amavisse -- thanks for raising this issue. Referencing the Prefetching Docs here, it seems like this is working as intended (in the latest version) and was actually a bug in the older version. Specifically, note the following section of docs:
In other words, if the Fortunately there's a way to opt-in to the behavior you're describing: if you pass In other words, update your function Navigation() {
const links = [
{ href: '/', name: 'Home' },
{ href: '/page1', name: 'Page1' },
{ href: '/page2', name: 'Page2' },
{ href: '/page3', name: 'Page3' },
]
return (
<nav className="flex flex-row justify-center gap-5 py-20">
{links.map((link, i) => (
<Link
className="hover:underline"
key={link.name + i}
href={link.href}
prefetch={true} // note the prefetch prop here
>
{link.name}
</Link>
))}
</nav>
)
} I'm going to close this as it seems to be working as designed, but if you have any questions about it, please don't hesitate to reply to this or raise in our Discussions forum. |
@ztanner Hi, if everything works as it should, that's suck I checked the version
const Folder: FC<IFolder> = ({ children, label, className, href = '#' }) => {
return (
<Link
prefetch={true} // next@14.1.0 and next@14.0.3-canary.7
scroll={false}
href={href}
className={cn(styles.folder, className)}
>
{children}
<div className={styles.label}>{label}</div>
</Link>
)
}
|
Hi @repcolding -- I didn't state that everything is working as expected, just that prefetching semantics in the version you mentioned were not the intended behavior. If there's a separate bug with CSS loading, we can look into that. |
I am facing the same issue , Next js 14 version Link component is terribly slow , navigating between pages takes hell out of you . @ztanner Please make sure higher versions are stable . |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/amavisse/next14-test
To Reproduce
I reproduced the issue here:
https://next13-test-teal.vercel.app/ - repo: https://github.com/amavisse/next13-test
https://next14-test-delta.vercel.app/ - repo: https://github.com/amavisse/next14-test
Current vs. Expected behavior
Current: page loading is very slow on next v14.1.0
Expected: fast loading as in https://next13-test-teal.vercel.app/
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Routing (next/router, next/navigation, next/link)
Which stage(s) are affected? (Select all that apply)
next dev (local), Vercel (Deployed)
Additional context
In the next v13.4.6, everything is going smoothly, while the v14.1.0 one is very slow when changing routes
Inspecting the dev console, inside the network tab, you can see the routes are correctly pre-fetched but when moving to the route, it's fetching it again, making it extremely slower.
Am I doing something wrong? bad practices? is it a bug?
The text was updated successfully, but these errors were encountered: