From 19cf65fec702204588e2a57a992f2f061b2cbf36 Mon Sep 17 00:00:00 2001 From: DefectingCat Date: Wed, 17 May 2023 14:15:41 +0800 Subject: [PATCH] fix post page render --- app/p/[slug]/page.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/p/[slug]/page.tsx b/app/p/[slug]/page.tsx index 4da5af9..0c07480 100644 --- a/app/p/[slug]/page.tsx +++ b/app/p/[slug]/page.tsx @@ -1,20 +1,20 @@ import rehypePrism from '@mapbox/rehype-prism'; -import Image from 'components/mdx/image'; import components from 'components/mdx/components'; -import PostCommnetLine from 'components/post/post-commnet-line'; import PostToc from 'components/post/post-toc'; import data from 'content/mdx-data'; import { readSinglePost } from 'lib/posts'; import { SingleToc, generateToc } from 'lib/utils'; -import { MDXRemote, compileMDX } from 'next-mdx-remote/rsc'; -import { serialize } from 'next-mdx-remote/serialize'; +import { compileMDX } from 'next-mdx-remote/rsc'; import { notFound } from 'next/navigation'; -import { Suspense, lazy } from 'react'; import rehypeSlug from 'rehype-slug'; import remarkGfm from 'remark-gfm'; import { Post } from 'types'; +import dynamic from 'next/dynamic'; -const PostComment = lazy(() => import('components/post/post-comment')); +const PostCommnetLine = dynamic( + () => import('components/post/post-commnet-line') +); +const PostComment = dynamic(() => import('components/post/post-comment')); const Page = async ({ params, @@ -28,7 +28,6 @@ const Page = async ({ const post = await readSinglePost(slug); const toc = generateToc(post); - // const { ref, inView } = useInView(); const calcLength = (prev: number, cur: SingleToc) => { const childLen = cur.children.length;