Defaulting to static rendering even with data mutations. What I am missing? #62578
Unanswered
peibolsang
asked this question in
App Router
Replies: 1 comment
-
As far as I know dynamic="force static" works for dynamic routes only. Render strategy for static routes will be determined base on the cache strategies. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been experimenting with ALL Next.js 14 rendering options and I have documented my findings.
All the findings above prompt the following question: why not mark all our pages (landing and dynamic routes) as static pages to be served from the CDN with
export const dynamic="force static"
to get the optimum performance?Then, we can revalidate tags/pages when data mutations happen.
revalidatePath()
orrevalidateTag()
so users will get fresh data after a mutation.I tested this, and it works. For use case number 2 (i.e., data mutations happen in your system), the data revalidation itself is fast, but:
x-vercel-cache=REVALIDATED
the next time it is accessed. The first access will be slow, but subsequent access will get aHIT
again and will be faster.x-vercel-cache=REVALIDATED
the next time it is accessed. The first access will be slow, but subsequent access will get aHIT
again and will be faster.What am I missing? Is this a good default approach?
Beta Was this translation helpful? Give feedback.
All reactions