Next.js Discord

Discord Forum

Next js Navigation Unresponsive

Unanswered
JJSenpai posted this in #help-forum
Open in Discord
I am using nextjs 15 app router and the navigation sometimes feels really slow. Clicking on a Link has significant delay between when loading.ts is shown.

I have tried using prefetch=true for full caching but after initial load this seems to make things worse in most cases.

What is the best way to move forward?

26 Replies

@JJSenpai I am using nextjs 15 app router and the navigation sometimes feels really slow. Clicking on a Link has significant delay between when loading.ts is shown. I have tried using prefetch=true for full caching but after initial load this seems to make things worse in most cases. What is the best way to move forward?
Azawakh
Remove prefetch={true} from most <Link> components to avoid downloading unused bundles on mount. Use static rendering with revalidate or Suspense with parallel data fetches to eliminate delays before loading.tsx appears. Measure bundle sizes and apply client caching with SWR for repeated visits.
@alfonsüs ardani does this behavior observed in `next dev` or `next start` ?
no if I use next start it is instant there
I am using aws amplify to deploy
@JJSenpai no if I use next start it is instant there
Azawakh
The delay you're seeing between clicking a <Link> and the loading.tsx UI appearing is almost certainly due to AWS Amplify's Lambda@Edge cold starts for SSR routes in the App Router—local next start runs directly without this serverless overhead, making it instant. To fix it, first enable Amplify's "Performance mode" in the console (under Hosting > Advanced settings) to extend Lambda caching and reduce cold starts, then shift dynamic routes to static rendering via export const revalidate = 60 or generateStaticParams where possible, as Amplify supports ISR but not on-demand revalidation. As a quick workaround for persistent cold starts, set up a Route53 health check to ping your domain every 30 seconds, keeping Lambdas warm without much cost.
@JJSenpai how do I measure bundle sizes??
Azawakh
1.Run next build — it generates a .next/analyze folder and prints a bundle analysis table in the terminal showing each page’s first-load JS, RSC payload, and shared chunks.
2.For visual breakdown, install @next/bundle-analyzer, add "analyze": "cross-env ANALYZE=true next build" to package.json, then run npm run analyze — it opens an interactive treemap at http://localhost:8888.
3.Check real-world sizes in production via Chrome DevTools → Network → filter by /_next/static/chunks/ and look at gzipped transfer sizes after deploying to Amplify.
I wanna that this helps you more.
@JJSenpai no if I use next start it is instant there
So it only happens on development?
yes
I tried updating to nextjs16 but I am getting this error
R]: !!! CustomerError: The size of the build output (260935884) exceeds the max allowed size of230686720 bytes. Please reduce the size ofyour build output and try again.
as far as im concerned there will be delay when you first navigate to a Link during development as it needs to render and build the files first
minor delay\ is fine, but sometimes it takes 4-5 even 10 s to reflect navigation click
When I was using prefetch={auto}, the issue was some routes blocked the navigation. Even after clicking the navigation bar to different route it would sometimes wait for the page to load then show loading.ts of other route.
maybe theres package/library that imports a huge file just like what Sunny assumed
Do you guys think switching to vercel for deployment will solve my problems?
you said it works fine and instant in build though?
yes, on local build
it works instant
only issues on deployment
but not on amplify's build?
oh
yikes yeah i would go and analyze build result just as sunny mentioned
oh okay, let me try that also
you can always try to deploy on vercel since its free to try