From d797dbd0bd161297e1e15bc4c8796829e341faaf Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Mon, 29 Apr 2024 22:37:08 +0200 Subject: [PATCH] Update use-replies.ts --- src/hooks/use-replies.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hooks/use-replies.ts b/src/hooks/use-replies.ts index 559c17da..6218fbd0 100644 --- a/src/hooks/use-replies.ts +++ b/src/hooks/use-replies.ts @@ -6,15 +6,15 @@ const useRepliesAndAccountReplies = (comment: Comment) => { // flatten all replies including nested ones from the original comment const flattenedReplies = useMemo(() => flattenCommentsPages(comment.replies), [comment.replies]); - // gemerate a Set of CIDs from flattened replies for quick lookup + // generate a Set of CIDs from flattened replies for quick lookup const replyCids = useMemo(() => new Set(flattenedReplies.map((reply) => reply.cid)), [flattenedReplies]); - // filter against all CIDs in flattened replies + // filter against the original comment's CID and all CIDs in flattened replies const filter = useCallback( (accountComment: Comment) => { - return replyCids.has(accountComment.parentCid); + return accountComment.parentCid === comment.cid || replyCids.has(accountComment.parentCid); }, - [replyCids], + [comment.cid, replyCids], ); const { accountComments } = useAccountComments({ filter });