Question presented to candidate: "A marketing page that should be static shows up as dynamic in the build output. How do you find out why, and what are the things that make a route dynamic?"
What a strong answer should cover:
- A route is dynamic when rendering it needs information that only exists at request time.
- Request-time APIs:
cookies(),headers(),searchParams,connection(),draftMode(); plusfetchwithcache: 'no-store'orrevalidate: 0. export const dynamic = 'force-dynamic'forces it explicitly.- A dynamic layout makes every page under it dynamic, even pages that read nothing.
- The build table (Ζ) and a
private, no-storecache-control header show the result; with Cache Components the build instead demands a Suspense boundary.
Clarifying questions expected:
- "Which layouts wrap this page?" β the cause is often in a shared layout.
- "Does the page need that request data for its first paint?" β if not, move it into Suspense.
Code / implementation expected: Yes β the triggers, and moving one into a Suspense boundary.