Next.js Discord

Discord Forum

NextJS 14: router get slow when navigate

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
I’m using router().push from next/navigation in build mode. The first time I navigate to a new page, it takes about 3–5 seconds to load, but from the second time onward it works fine. Is this expected, or am I missing something?

2 Replies

@Transvaal lion I’m using router().push from next/navigation in build mode. The first time I navigate to a new page, it takes about 3–5 seconds to load, but from the second time onward it works fine. Is this expected, or am I missing something?
The first navigation is slow because Next.js loads and hydrates the page bundle. The second time is instantaneous because the code has been previously cached in the browser
I may be wrong, but I think that's it