Prefetch Query and NextJS SSR
Hi, if I'm prefetching a query in SSR or ISR (in getStaticProps), does the prefetch actually block rendering/navigation? i.e. in the await prefetchQuery call, is the promise resolved when the actual function being executed in the prefetch resolves or does it resolve almost immediately?
I basically want to know if there are any real downsides to prefetching my initial page queries, like if it can affect my initial render time or navigation time when ISR is not cached
3 Replies
magic-amberOP•3y ago
also would client side ISR navigations (without cache) be affected by prefetch as well?
fair-rose•3y ago
yes it means every time you navigate, next will make a request to that gSSP function, and
await prefetchQuery will block itmagic-amberOP•3y ago
oh, and that blocking amount is directly related to how long it takes to finish that query right @TkDodo 🔮
so SSR is okay but client side navigations will have a worse experience 🤔