fix(ui): add defensive checks for undefined replies in video page comments

This commit is contained in:
Yusuf İpek
2026-02-15 09:36:02 +03:00
parent bf6a8aa4e8
commit 643697dc00
+3 -3
View File
@@ -1220,7 +1220,7 @@ export function VideoPageContent({ mode, videoId, projectId: propProjectId }: Vi
...v,
comments: v.comments.map((c) =>
c.id === parentId
? { ...c, replies: [...c.replies, optimisticReply] }
? { ...c, replies: [...(c.replies || []), optimisticReply] }
: c
),
}
@@ -1282,7 +1282,7 @@ export function VideoPageContent({ mode, videoId, projectId: propProjectId }: Vi
...v,
comments: v.comments.map((c) =>
c.id === parentId
? { ...c, replies: c.replies.filter(r => r.id !== tempId) }
? { ...c, replies: (c.replies || []).filter(r => r.id !== tempId) }
: c
),
}
@@ -1303,7 +1303,7 @@ export function VideoPageContent({ mode, videoId, projectId: propProjectId }: Vi
...v,
comments: v.comments.map((c) =>
c.id === parentId
? { ...c, replies: c.replies.filter(r => r.id !== tempId) }
? { ...c, replies: (c.replies || []).filter(r => r.id !== tempId) }
: c
),
}