loading page waterfall
Answered
Japanese pilchard posted this in #help-forum
Japanese pilchardOP
I have pages such as /settings, /settings/account, and /settings/achievements, each with their own loading state.
However, since account and achievements are children of settings/ (settings/ also has a layout), it is rendering the settings loading state on initial load on slow devices and then half a second or so later, rendering the achievement pages loading state.
This is of course very sub-optimal, and I am wondering how I can solve this loading problem. This is why I don't have a base loading case for root route, because I don't want all the other routes inheriting this, and then having two loading stages for slow devices.
Any tips how to fix this (bind the root loading page only to the root page and not allow this inheritance)?
However, since account and achievements are children of settings/ (settings/ also has a layout), it is rendering the settings loading state on initial load on slow devices and then half a second or so later, rendering the achievement pages loading state.
This is of course very sub-optimal, and I am wondering how I can solve this loading problem. This is why I don't have a base loading case for root route, because I don't want all the other routes inheriting this, and then having two loading stages for slow devices.
Any tips how to fix this (bind the root loading page only to the root page and not allow this inheritance)?
Answered by Catalan Sheepdog
Hey @Japanese pilchard I think that Route Groups https://nextjs.org/docs/app/building-your-application/routing/route-groups might be the solution to your problem:
https://nextjs.org/learn/dashboard-app/streaming#fixing-the-loading-skeleton-bug-with-route-groups
https://nextjs.org/learn/dashboard-app/streaming#fixing-the-loading-skeleton-bug-with-route-groups
2 Replies
Catalan Sheepdog
Hey @Japanese pilchard I think that Route Groups https://nextjs.org/docs/app/building-your-application/routing/route-groups might be the solution to your problem:
https://nextjs.org/learn/dashboard-app/streaming#fixing-the-loading-skeleton-bug-with-route-groups
https://nextjs.org/learn/dashboard-app/streaming#fixing-the-loading-skeleton-bug-with-route-groups
Answer
@Catalan Sheepdog Hey <@1056010204828925973> I think that Route Groups https://nextjs.org/docs/app/building-your-application/routing/route-groups might be the solution to your problem:
https://nextjs.org/learn/dashboard-app/streaming#fixing-the-loading-skeleton-bug-with-route-groups
Japanese pilchardOP
Oh yep. Thanks!