From 34a662fb30ee3e1237750a70dccb9aec373a2bf4 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sat, 11 Apr 2026 01:04:36 -0300 Subject: [PATCH] feat: add loading skeleton for article content using Suspense --- src/app/(pages)/article/[slug]/page.tsx | 55 ++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/src/app/(pages)/article/[slug]/page.tsx b/src/app/(pages)/article/[slug]/page.tsx index 783d6ac..c5947ea 100644 --- a/src/app/(pages)/article/[slug]/page.tsx +++ b/src/app/(pages)/article/[slug]/page.tsx @@ -2,6 +2,7 @@ import { getArticleBySlug } from '@/lib/feature/article/article.external'; import { ArrowLeftIcon, CalendarIcon, ClockIcon } from 'lucide-react'; import Link from 'next/link'; import { notFound } from 'next/navigation'; +import { Suspense } from 'react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; @@ -22,8 +23,48 @@ function formatDate(date: Date): string { }).format(date); } -const ArticlePage = async ({ params }: ArticlePageProps) => { - const { slug } = await params; +const ArticleContentSkeleton = () => ( +
+
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+ +
+ {[...Array(4)].map((_, i) => ( +
+
+
+
+
+ ))} +
+
+
+
+); + +const ArticleContent = async ({ slug }: { slug: string }) => { const article = await getArticleBySlug(slug); if (!article) notFound(); @@ -96,4 +137,14 @@ const ArticlePage = async ({ params }: ArticlePageProps) => { ); }; +const ArticlePage = async ({ params }: ArticlePageProps) => { + const { slug } = await params; + + return ( + }> + + + ); +}; + export default ArticlePage;