From 3950f7b8647df971e4e1bb4147838ae60e3166ac Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sat, 13 Jul 2024 09:53:49 +0200 Subject: [PATCH] fix(replies): a reply would not appear immediately if published to a reply that was just published --- src/hooks/use-replies.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hooks/use-replies.ts b/src/hooks/use-replies.ts index 8463621b..ca00f995 100644 --- a/src/hooks/use-replies.ts +++ b/src/hooks/use-replies.ts @@ -12,7 +12,9 @@ const useReplies = (comment: Comment) => { // filter against the original comment's CID and all CIDs in flattened replies const filter = useCallback( (accountComment: Comment) => { - return accountComment.parentCid === comment?.cid || replyCids.has(accountComment.parentCid); + const parentCid = accountComment.parentCid || 'n/a'; + const isCidInDocument = !!document.querySelector(`[data-cid="${parentCid}"]`); + return parentCid === (comment?.cid || 'n/a') || replyCids.has(parentCid) || isCidInDocument; }, [comment?.cid, replyCids], );