`revalidate` and Edge runtime
Answered
Dwarf Crocodile posted this in #help-forum
Dwarf CrocodileOP
According to Next.js documentation, the segment option
Can someone explain the reason of this limitation? What is the technical constraint? Will it change in the future?
Since I cannot control
revalidate is not compatible with Edge runtime. Can someone explain the reason of this limitation? What is the technical constraint? Will it change in the future?
Since I cannot control
revalidate on Edge, how does one specify the cache duration for a given page? From my understanding, next.revalidate can be used for fetch, is this the only way to do so?7 Replies
@Dwarf Crocodile According to Next.js documentation, the segment option `revalidate` is not compatible with Edge runtime.
Can someone explain the reason of this limitation? What is the technical constraint? Will it change in the future?
Since I cannot control `revalidate` on Edge, how does one specify the cache duration for a given page? From my understanding, `next.revalidate` can be used for `fetch`, is this the only way to do so?
It’s a constraint, edge runtime pages currently cannot be static hence revalidate is meaningless (it’s always revalidate = 0)
Dwarf CrocodileOP
Why couldn't they be static? My application renders the same whereas
runtime = "edge" or not.Since
export const revalidate = TTL is no use when the runtime is edge, would setting next.revalidate enable data caching?@Dwarf Crocodile Why couldn't they be static? My application renders the same whereas `runtime = "edge"` or not.
They can’t be static (yet) because that’s a next limitation
Answer
At least, unstable_cache does work
Dwarf CrocodileOP
Alright. Thanks for your help.