when changing route, the url updates slow and only changes when the data fetch has been completed
Unanswered
πΉπΎ_π·πππππππππππ π posted this in #help-forum
I am currently facing some issue when changing the url. Let's say I click on a link then clicking on that link does some fetch call. But the problem is that when I click on the link then it doesn't change the url when I click on the link but it changes after certain time which I think is first doing all the fetch calls and then later after getting the data it changes the url. Is this is the actual behaviour ? I mean when clicked on a link, I want the url to update and then let the fetch call be done. At that time I want to implement NProgress package to add a progress bar at top. Any idea what to do ?
8 Replies
This sort of delay is often encountered when using next dev (via yarn dev or npm dev). This is because when using next dev, page is rebuild every time it is requested. So when you navigate back to the index page, Next.js first rebuild that page for you and then it is served. That's why there is a delay.
This maybe what you're experiencing
I'm not sure tho
but even in the prod i am facing this issue. The thing is when I click on a link, the url should be updated at that time when the button is clicked? Isn't that the default behavior of next/link ?
Hmm, I'm facing same too, the first time takes time to load. but after the first time, the page is loaded pretty instantly.
I'm not sure, but this can be related to router cache.
yes, for the first time it takes time but once it loads it doesnt take time to load again as its been cached if there's any data fetching going on. As nextjs default cache the data fetched from server