Comments (3)
Ahh, I see what you mean @AkifumiSato -- let me take a closer look at why we needed that condition and I'll get back to you!
from next.js.
Hi @AkifumiSato -- the names "static" and "dynamic" do not relate to the page rendering type, but rather different categories of "liveness" that can be configured. The actual heuristic of whether to use dynamic
or static
is based on the prefetch
prop. From the docs:
The dynamic property is used when the prefetch prop on Link is left unspecified.
The static property is used when the prefetch prop on Link is set to true, or when calling router.prefetch.
The different properties of this config refer to variable levels of "liveness" and are unrelated to whether the segment itself is opting into static or dynamic rendering. In other words, the current static default of 5 minutes suggests that data feels static by virtue of it being revalidated infrequently.
So in this case, static
will influence:
- How long a
loading.js
segment is held onto before being refetched from the server - How long a segment with
prefetch={true}
will be held onto before being refetched from the server.
If you modify the Link components to have prefetch={true}
, you'll see that your static
staleTime property is used.
Let me know if I misunderstood your question!
from next.js.
@ztanner Thank you for response.
The dynamic property is used when the prefetch prop on Link is left unspecified.
I tried with prefetch={undefined}
for a static rendered page and staleTimes.static
was applied until the cache was first used. After the second time, staleTimes.dynamic
is applied. This seems to be caused by isFirstRead
.
I think the documentation needs to be changed to describe up to the first use of the cache or to a simpler specification. What do you think?
from next.js.
Related Issues (20)
- `Request` object behaves differently in fetch HOT 7
- navigating back from multiple intercepted route breaks routing
- Turbopack: Unable to load SVG. Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
- Middleware added Nonce attributes missing from TypeScript production builds
- typedRoutes don't recognize parameter on rewritten url if preceded by path character
- Github actions: Error: Page "/logs/publish/[id]" is missing "generateStaticParams()" so it cannot be used with "output: export" config. HOT 1
- Next 14 shows flicker with external React Native components on web
- Preflight cache middleware opt-out not working for rewrite of dynamic routes
- [Turbopack] [Next 15 RC] Cannot resolve exported paths from `@skeletonlabs/skeleton@next` HOT 2
- redirect in NextJS config doesn't populate param in `destination` more than once
- The Edge Function "middleware" size is 1.01 MB and your plan size limit is 1 MB. Though the file is 173kb HOT 4
- Subresource Integrity (SRI) not working HOT 1
- global-error.tsx doesn't work next.js 14+
- [Next 15 RC] create-next-app --empty with tw and src dir has wrong content path HOT 3
- CORS middleware not applied to preview and staging domains, but works on production domain
- From my testing, when GET and PUT are the only methods set, it breaks. I also tried changing the order in which they are set.
- Request method bug in production environment. HOT 3
- Next.js doesn't resolve docker network defined hostnames HOT 1
- `npm start`/`next start` fails HOT 1
- Cookies, logout/auth issue after 14.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next.js.