Nextjs 13 routing takes 2-3 seconds to load
Unanswered
Raspberry Horntail posted this in #help-forum
Raspberry HorntailOP
Im facing the exact same issue as him https://stackoverflow.com/questions/76215770/next-js-13-improve-page-loading-time-and-display-a-stable-spinner-during-route. Appreciate it if anyone can help ðŸ™
23 Replies
Golden-winged Warbler
are you in dev mode and seeing compilation happening, or in production mode after a build?
I've noticed this behavior in dev mode, due to compilation, but not after building for production, where it goes away
I've noticed this behavior in dev mode, due to compilation, but not after building for production, where it goes away
not /app, but /app/example
the OP of the linked post is using loading.tsx wrong
idk about your case though
@joulev create a loading.tsx inside /app/example
Raspberry HorntailOP
Why in example? I tried adding loading to root but doesn’t work
/example page requires time to fetch the data, that is the cause of this issuethe time it can render instantly is thanks to soft navigation
and to display loading state for that page, you use
app/example/loading.tsxapp/loading.tsx is the loading state for /Raspberry HorntailOP
So example route is the standard? Seems so weird
The docs doesn’t specify this though
there is literally a whole page dedicated to loading states
@joulev what standard?
Raspberry HorntailOP
I mean why must I put it in example folder?
@joulev there is literally a whole page dedicated to loading states
Raspberry HorntailOP
I tried this. It doesn’t load
@Raspberry Horntail I mean why must I put it in example folder?
i'm speaking about the post you linked. they do data fetching in
/example. that is why you have to put loading.tsx inside app/example. if you do data fetching in /dashboard you have to put it in app/dashboard and so onRaspberry HorntailOP
LMAO
Ok
I’ll try again
you never said anything about your own code, you simply said "Im facing the exact same issue as him", how am I supposed to know what route you use to fetch data?