From bf6a8aa4e8b5a751ce15bc020d868ef62fa0ef7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusuf=20=C4=B0pek?= Date: Sun, 15 Feb 2026 09:29:50 +0300 Subject: [PATCH] fix(ui): add defensive replies array handling in video page comments --- components/video-page-content.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/video-page-content.tsx b/components/video-page-content.tsx index c386896..576f14f 100644 --- a/components/video-page-content.tsx +++ b/components/video-page-content.tsx @@ -902,7 +902,7 @@ export function VideoPageContent({ mode, videoId, projectId: propProjectId }: Vi ...prev, versions: prev.versions.map((v) => v.id === activeVersionId - ? { ...v, comments: v.comments.map(c => c.id === tempId ? { ...newComment, replies: newComment.replies || [] } : c) } + ? { ...v, comments: v.comments.map(c => c.id === tempId ? { ...newComment, replies: newComment.replies || [] } : { ...c, replies: c.replies || [] }) } : v ), }; @@ -1263,8 +1263,8 @@ export function VideoPageContent({ mode, videoId, projectId: propProjectId }: Vi ...v, comments: v.comments.map((c) => c.id === parentId - ? { ...c, replies: c.replies.map(r => r.id === tempId ? newReply : r) } - : c + ? { ...c, replies: (c.replies || []).map(r => r.id === tempId ? newReply : r) } + : { ...c, replies: c.replies || [] } ), } : v @@ -1411,7 +1411,7 @@ export function VideoPageContent({ mode, videoId, projectId: propProjectId }: Vi if (c.id === commentId) return { ...c, content: editText.trim(), tag: editTagId !== undefined ? editedTag : c.tag }; return { ...c, - replies: c.replies.map((r) => + replies: (c.replies || []).map((r) => r.id === commentId ? { ...r, content: editText.trim() } : r ), };