From 468ab5b92cdfc1166ba9c1b7eac32bee5263def0 Mon Sep 17 00:00:00 2001 From: Minghe Huang Date: Sat, 21 Mar 2026 16:48:01 +0100 Subject: [PATCH] perf: use getBlogPost(id) directly in blog detail page --- app/blog/[id]/page.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/blog/[id]/page.tsx b/app/blog/[id]/page.tsx index bfdfab2e..918c019d 100644 --- a/app/blog/[id]/page.tsx +++ b/app/blog/[id]/page.tsx @@ -1,16 +1,15 @@ import { PostContainer } from './component' -import { createSmartClient } from '@/lib/smartClient' -import BlogDiscussions from '@/components/BlogDiscussions' import { getServerSession } from 'next-auth/next' import { authOptions } from '@/lib/auth' +import { createSmartClient } from '@/lib/smartClient' +import BlogDiscussions from '@/components/BlogDiscussions' export const revalidate = process.env.NODE_ENV === 'development' ? 0 : 60; export default async function Page({ params }: { params: { id: string } }) { - const session = await getServerSession(authOptions); + const session = await getServerSession(authOptions) const client = createSmartClient(session?.accessToken) - const posts = await client.getBlogPosts() - const post = posts.find((p) => p.id === decodeURIComponent(params.id)) + const post = await client.getBlogPost(decodeURIComponent(params.id) + '.md') if (!post) { return
Post not found