Skip to content

Commit

Permalink
feat: dynamically import ArticleContent component for client-side r…
Browse files Browse the repository at this point in the history
…endering
  • Loading branch information
charlottewiltshire0 committed Jan 2, 2025
1 parent 295cc6c commit c3a985a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/(root)/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
"use client";

import { getPostBySlug } from "@/lib/blog";
import { ArticleSplash } from "@/components/blog/article-splash";
import { ArticleContent } from "@/components/blog/article-content";
import { ArticleNotFoundPage } from "@/components/blog/article-not-found";
import dynamic from "next/dynamic";
import { Post } from "@/sanity/schemaTypes/postType";

const ArticleContentClient = dynamic<{
article: Post;
}>(
() =>
import("@/components/blog/article-content").then(
(mod) => mod.ArticleContent
),
{ ssr: false }
);

export default async function Article({
params,
Expand All @@ -21,7 +34,7 @@ export default async function Article({
<div className="flex flex-col items-center justify-center">
<div className="max-w-[800px]">
<ArticleSplash article={post[0]} />
<ArticleContent article={post[0]} />
<ArticleContentClient article={post[0]} />
</div>
</div>
</div>
Expand Down

0 comments on commit c3a985a

Please sign in to comment.