#Force dynamic on page or layout
1 messages · Page 1 of 1 (latest)
Hi @winged cliff. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
When you set force-dynamic on a page, it doesn't automatically make the parent layout dynamic. The layout will still follow its own caching behavior based on how it's configured.
According to the NextJS documentation, route segment configuration options like dynamic: 'force-dynamic' apply specifically to the segment where they're defined. This means:
- If you set
force-dynamicon a page, only that page will be dynamically rendered on each request - The parent layout will maintain its own caching behavior (static by default)
This can sometimes lead to unexpected behavior where your dynamic page is getting fresh data on each request, but the layout containing it is still using cached data.
There's an interesting issue related to this behavior described in the GitHub repository. In one case, a user found that when navigating between static and dynamic segments, the layout component from the static segment would receive updated data when refreshing the dynamic segment, despite being marked as force-static GitHub Issue #46715.
If you need both the page and layout to be dynamic, you should set force-dynamic on both the page and the layout separately.