From c7bc942515a10c3365a19bf759a394be365d3287 Mon Sep 17 00:00:00 2001 From: "hs.o_k" Date: Thu, 1 May 2025 03:23:52 +0900 Subject: [PATCH] =?UTF-8?q?[=20fix=20]=20#430=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84=20=EB=AC=B4=ED=95=9C=20=EB=B0=9B?= =?UTF-8?q?=EC=95=84=EC=98=A4=EA=B8=B0=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/app/components/CommentsSection.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/components/CommentsSection.tsx b/frontend/src/app/components/CommentsSection.tsx index 4ee2b9e3..78460908 100644 --- a/frontend/src/app/components/CommentsSection.tsx +++ b/frontend/src/app/components/CommentsSection.tsx @@ -335,9 +335,12 @@ export function CommentsSection({ postId }: { postId: number }) { // ─── 프로필 이미지 불러오기 ──────────────────────────────────── useEffect(() => { - if (!comments.length) return + if (!rawComments.length) return const ids = Array.from( - new Set([...comments.map((c) => c.userId), ...comments.flatMap((c) => c.replies.map((r) => r.userId))]), + new Set([ + ...rawComments.map((c) => c.userId), + ...rawComments.flatMap((c) => c.replies.map((r) => r.userId)), + ]), ) async function fetchUserImages() { const map: Record = {} @@ -354,7 +357,7 @@ export function CommentsSection({ postId }: { postId: number }) { setUserImages(map) } fetchUserImages() - }, [comments]) + }, [rawComments]) // ─── 렌더링 ──────────────────────────────────────────────────── return (