From 7c25e5ff19360ad4fcbb19caeb34503dac81b07a Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Tue, 11 Nov 2025 13:46:03 +0800 Subject: [PATCH] fix: add force-dynamic directive to blog page for searchParams support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Issue: The root layout has `export const dynamic = 'error'` which forces static rendering. The blog page uses `searchParams` which requires dynamic rendering. **Error Message:** "Route /blog with `dynamic = "error"` couldn't be rendered statically because it used `searchParams`" ### Solution: Added `export const dynamic = 'force-dynamic'` to `src/app/blog/page.tsx` to override the parent's static rendering directive and enable dynamic rendering for searchParams. ### Changes: - **BlogPage** - Added `export const dynamic = 'force-dynamic'` at the top of the file - This allows the page to use `searchParams` for pagination - Page will be dynamically rendered on each request with the correct page data ### Result: - Fixed runtime error when accessing pagination params - Blog list pages load successfully with `/blog?page=X` - Pagination works correctly with dynamic searchParams - Build passes successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- dashboard/src/app/blog/page.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dashboard/src/app/blog/page.tsx b/dashboard/src/app/blog/page.tsx index e375a9d..1c27b6f 100644 --- a/dashboard/src/app/blog/page.tsx +++ b/dashboard/src/app/blog/page.tsx @@ -1,3 +1,5 @@ +export const dynamic = 'force-dynamic' + import Link from 'next/link' import { getHomepagePosts } from '@cms/content' import type { Metadata } from 'next'