#Can I set `force-dynamic` as a default instead of declare each pages.tsx?

3 messages · Page 1 of 1 (latest)

gleaming elk
#

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 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

Learn about how to configure options for Next.js route segments.

sturdy harnessBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

sage monolith
#

Hi 👋

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.