Can I set `force-dynamic` as a default instead of declare each pages.tsx?
Unanswered
Ryota Murakami posted this in #help-forum
I'm working on assets manegement app with NextAuth, Axios, react-fook-form, zod and that has no static page without login page.
All page never use to cache, contents are dynamic fetch depends on authenticated user, backend data.
So I'm finding way to convert each pages
Is it impssible now?
https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
All page never use to cache, contents are dynamic fetch depends on authenticated user, backend data.
So I'm finding way to convert each pages
const dynamic = 'force-dynamic' declation one place like next.config.js.Is it impssible now?
https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
2 Replies
Siberian Flycatcher
Hi 👋
You can add
However, all fetches that depend on cookies (authenticated user) should automatically opt the page out of static rendering and render dynamically without any additional declarations.
You can add
export const dynamic = 'force-dynamic' to app/layout. This will enable dynamic rendering for all pages.However, all fetches that depend on cookies (authenticated user) should automatically opt the page out of static rendering and render dynamically without any additional declarations.