fix(reply): no need to render deleted replies that have no children

This commit is contained in:
Tom (plebeius.eth)
2025-06-03 22:18:32 +02:00
parent b49216b555
commit f233da9806
2 changed files with 16 additions and 10 deletions
+4 -1
View File
@@ -450,7 +450,10 @@ const PostDesktop = ({ post, roles, showAllReplies, showReplies = true }: PostPr
!isInPendingPostView && !isInPendingPostView &&
replies && replies &&
showReplies && showReplies &&
(showAllReplies || showOmittedReplies[cid] ? replies : replies.slice(-5)).map((reply, index) => ( (showAllReplies || showOmittedReplies[cid] ? replies : replies.slice(-5))
// Don't render deleted replies that have no children (replyCount = 0)
.filter((reply) => !(reply.deleted && (reply.replyCount === 0 || !reply.replyCount)))
.map((reply, index) => (
<div key={index} className={styles.replyContainer}> <div key={index} className={styles.replyContainer}>
<Reply reply={reply} roles={roles} postReplyCount={replyCount} /> <Reply reply={reply} roles={roles} postReplyCount={replyCount} />
</div> </div>
+4 -1
View File
@@ -359,7 +359,10 @@ const PostMobile = ({ post, roles, showAllReplies, showReplies = true }: PostPro
!isInPendingPostView && !isInPendingPostView &&
replies && replies &&
showReplies && showReplies &&
(showAllReplies ? replies : replies.slice(-5)).map((reply, index) => ( (showAllReplies ? replies : replies.slice(-5))
// Don't render deleted replies that have no children (replyCount = 0)
.filter((reply) => !(reply.deleted && (reply.replyCount === 0 || !reply.replyCount)))
.map((reply, index) => (
<div key={index} className={styles.replyContainer}> <div key={index} className={styles.replyContainer}>
<Reply postReplyCount={replyCount} reply={reply} roles={roles} /> <Reply postReplyCount={replyCount} reply={reply} roles={roles} />
</div> </div>