Prefetching /post/[slug]/loading.js not working
Unanswered
Northern Bobwhite posted this in #help-forum
Northern BobwhiteOP
Is it by design that a
All of the above applies to
(Note: I do run it in production mode, I know
loading.js file in a dynamic route is never prefetched? The docs promise Instant Loading States (https://nextjs.org/docs/app/building-your-application/routing/loading-ui-and-streaming#instant-loading-states), but that just doesn't seem to work in a dynamic route. It does work if I put the file at /post/loading.js instead in my example, but I don't know if that is intended.All of the above applies to
layout.js files as well (and possibly more), they do not get prefetched when placed behind a dynamic route segment.(Note: I do run it in production mode, I know
Links aren't prefetched in development mode)2 Replies
Northern BobwhiteOP
To add to this, the docs (https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#1-prefetching) also say that for dynamic routes "the shared layout down until the first loading.js file is prefetched" which is just not the behavior I'm seeing
Northern BobwhiteOP
I found https://github.com/vercel/next.js/issues/43548 which seems to be the exact same problem, which was marked as fixed without (seemingly) the problem actually having been fixed