Next.js Discord

Discord Forum

my app router page is ignoring force-dynamic

Answered
Finnish Hound posted this in #help-forum
Open in Discord
Finnish HoundOP
Hi not sure what's going on but one of my pages is throwing a static generation error even though the page itself should be dynamic

I have export const dynamic = 'force-dynamic'
but looking at the build it's still trying to force that directory to be static

I have this value in the page and layout of the folder but it seems to be ignoring it and trying to force it to be static? How can i force dynamic if the flag is not working ?

my next info output if it helps


Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000
Binaries:
Node: 19.3.0
npm: 9.2.0
Yarn: 1.22.19
pnpm: N/A
Relevant Packages:
next: 14.0.4-canary.43
eslint-config-next: 14.0.3
react: 18.2.0
react-dom: 18.2.0
typescript: 5.2.2
Next.js Config:
output: standalone
Answered by Finnish Hound
this helped a bit it seems the reason why it wasn't accepting the dynamic flag was because it only works in server components
I didn't realize until i looked but I was using use client in that layout folder
View full answer

2 Replies

Fire ant
Try put the export const after importing all your component
Finnish HoundOP
this helped a bit it seems the reason why it wasn't accepting the dynamic flag was because it only works in server components
I didn't realize until i looked but I was using use client in that layout folder
Answer