Next.js Discord

Discord Forum

Next.JS ISG navigation slow

Unanswered
Australian Freshwater Crocodile posted this in #help-forum
Open in Discord
Australian Freshwater CrocodileOP
Hello, I'm working on a blog application that utilizes ISG (Incremental Static Generation) with on-demand revalidation. However, I'm encountering slow navigation, sometimes taking up to 8 seconds to load each page. Interestingly, when I disable JavaScript, the page builds very quickly, and navigation becomes smooth and almost instant.

I am using Apollo Client to make server-side requests, and I have verified through logs that these requests are cached and not re-executed on every page visit. Therefore, the issue doesn't seem to be originating from there. I've attempted using shallow routing, which slightly improves navigation speed, but it has some drawbacks:

1. It fails to work when the URL structure changes. For instance, transitioning from /home to /home/category triggers a page rebuild, causing an 8-second delay. The same happens when moving from /home/category back to /home.
2. I need to handle the loading state, which wouldn't normally be a concern.

If anyone has insights or pointers on what might be causing these issues, your help would be greatly appreciated.

0 Replies