When does a static route without "use cache" get re-rendered? #85363
-
|
I assumed that a route without "use cache" would render only at build time, After deploying a static page without "use cache", I noticed that console.log runs again if I revisit the page after some time. Could someone clarify when such a route is re-rendered (or revalidated)? export default function Page() {
console.log("static page rendered");
return <p>Static Page</p>;
} |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
Is that all there's to the route? And Cache Components enabled right? Where/how's this deployed? |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your support! Here’s what I did:
After waiting for a while and reloading the page, the I also created a test page that uses faker, and after leaving it for a few minutes and refreshing, the displayed name sometimes changes — though not always, and I haven’t figured out the exact pattern yet.
layout.tsx with "use cache" layout.tsx without "use cache" code "next": "16.0.0" 2025-10-28.10.22.36.mov |
Beta Was this translation helpful? Give feedback.
-
|
@icyJoseph In other words, if I want to achieve fully static pre-generation, should I avoid setting |
Beta Was this translation helpful? Give feedback.
-
|
@icyJoseph I’ve confirmed that when use cache is not used, the page is built only once at build time. Since it’s not realistic to avoid using use cache across all layouts and components, I solved this by attaching a custom cache only to the parts that I want to be one-time builds. export default function Page() {
"use cache";
cacheLife("infinite");
return <div>...</div>
}import type { NextConfig } from "next";
const nextConfig: NextConfig = {
cacheComponents: true,
cacheLife: {
infinite: {
stale: Number.MAX_VALUE,
revalidate: Number.MAX_VALUE,
expire: Number.MAX_VALUE,
},
},
};
export default nextConfig;However, if a lower-level component within the page has a shorter cache duration, that duration takes precedence. |
Beta Was this translation helpful? Give feedback.

@icyJoseph
Thank you for your response!
I’ve confirmed that when use cache is not used, the page is built only once at build time.
However, if any part of the page (including layouts) uses use cache, the entire page will be regenerated according to the shortest cache duration among them.
Since it’s not realistic to avoid using use cache across all layouts and components, I solved this by attaching a custom cache only to the parts that I want to be one-time builds.