Next.js Discord

Discord Forum

Make dynamic pages initial server response time faster

Unanswered
Siamese Crocodile posted this in #help-forum
Open in Discord
Siamese CrocodileOP
Hi, I've noticed that when my page is static its initial server response is around 50ms and when the page is dynamic its around 1-1.25s. I know it needs to do stuff before it shows me the actual page but isnt there an option to show a skeleton instantly? Loading.tsx doesnt work

7 Replies

Plott Hound
Loading tsx will only wait for asynchronous operations happening in server components. If you have async things in files marked with use client or their children then it won’t be handled by loading.tsx or suspense.
Siamese CrocodileOP
Ik but what else can I do to make initial load on dynamic pages fast
the same as on static pages
Plott Hound
is this in prod or dev?
Siamese CrocodileOP
Prod
@Siamese Crocodile Prod
I would suggest using data cache with unstable_cache to reduce the loading speed
@Siamese Crocodile Ik but what else can I do to make initial load on dynamic pages fast
Plott Hound
Move your asynchronous functions to server components or handle a client side loading state. You can also improve it by caching as ray suggested