Replies: 1 comment 1 reply
-
Hi @X-Zero-L 👋 Yes they can coexist. In the App Router you can make the default for a route ISR, and opt-out per request to dynamic when the id requires auth. How to wire it export const revalidate = 300; // ISR by default export async function generateStaticParams() { export default async function Page({ params }: { params: { id: string } }) { // Look up metadata to decide if this id is private if (meta.private) { // Public: stays on ISR (cached & revalidated) revalidate makes the route ISR by default. Calling noStore() (or using fetch(..., { cache: 'no-store' })) opts out per request, turning that render fully dynamic and uncacheable. generateStaticParams + dynamicParams: true lets you prebuild a subset and serve the rest on demand. When to use Middleware? Only if you need to rewrite/redirect (e.g., send private IDs to /login) based on the path/headers. It’s not required for the mixed caching strategy above. Important: ensure private branches always call noStore() (or only cache: 'no-store' fetches) so authenticated content never leaks into the ISR cache. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have a dynamic route post/[id] where some IDs should use ISR for static generation, while others require authentication checks and should remain dynamic. Is it possible to have mixed rendering strategies within the same route pattern?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions