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
+8 -5
View File
@@ -359,11 +359,14 @@ const PostMobile = ({ post, roles, showAllReplies, showReplies = true }: PostPro
!isInPendingPostView &&
replies &&
showReplies &&
(showAllReplies ? replies : replies.slice(-5)).map((reply, index) => (
<div key={index} className={styles.replyContainer}>
<Reply postReplyCount={replyCount} reply={reply} roles={roles} />
</div>
))}
(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}>
<Reply postReplyCount={replyCount} reply={reply} roles={roles} />
</div>
))}
{showRules && (
<div className={styles.replyContainer}>
<Reply reply={subplebbitRulesReply} />