Using fetch not opting out static rendering
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
In Next.js 15, the response of the fetch request is not cached by default.
So now, isn't a fetch request an uncached data request? If yes, then how does a route with a default fetch configuration still statically render? (image-1)
Because as we know, If you use dynamic api/ uncached data request in a route, the route becomes dynamically rendered.(image-2)
So now, isn't a fetch request an uncached data request? If yes, then how does a route with a default fetch configuration still statically render? (image-1)
Because as we know, If you use dynamic api/ uncached data request in a route, the route becomes dynamically rendered.(image-2)
4 Replies
Fetch is not part of what Nextjs call "dynamic API" so the page can still be static
Dynamic APIs like cookies and headers, and the searchParams prop in Pages depend on runtime incoming request information. Using them will opt a route out of the Full Route Cache, in other words, the route will be dynamically rendered.
Cape lionOP
Thank you for your response. It's clear to me what is considered Dynamic APIs. But alongside "Dynamic API" it is also mentioned that if "uncached data request" is discovered, Next.js will switch to dynamically rendering the whole route. So here what does it mean by "uncached data request"?
https://nextjs.org/docs/app/building-your-application/rendering/server-components#switching-to-dynamic-rendering
https://nextjs.org/docs/app/building-your-application/rendering/server-components#switching-to-dynamic-rendering