Route segment configuration controls caching, rendering mode, and execution limits for an individual Next.js App Router segment. Streaming requires caching to be disabled. section 8.1.1
Configure streaming routes with settings that match the deployment environment:
- Set dynamic to 'force-dynamic' to force dynamic rendering. section 8.1.1
- Set maxDuration to limit streaming responses to a defined runtime, such as 30 seconds. section 8.1.1
- Call unstable_noStore from next/cache when component-level cache opt-out is needed for fresh data. section 8.1.1
Force dynamic streaming
Add configuration at the top of the page component for the route segment:\n\nexport const dynamic = 'force-dynamic';\nexport const maxDuration = 30; section 8.1.1
// Force the page to be dynamic and allow // streaming responses up to 30 seconds export const dynamic = 'force-dynamic'; export const maxDuration = 30;
View the compact route-segment configuration used to enable dynamic rendering and allow streaming responses for up to 30 seconds. section 8.1.1
