fix(post): render OP backlinks from replies quoting OP

This commit is contained in:
plebeius
2026-02-11 18:52:10 +08:00
parent 716c782d1a
commit d862550132
3 changed files with 15 additions and 33 deletions
+7 -15
View File
@@ -76,7 +76,6 @@ const PostInfo = ({
onApprove,
onReject,
quotedByMap,
cidToReply,
}: PostProps) => {
const { t } = useTranslation();
const { author, cid, deleted, locked, pinned, parentCid, postCid, reason, removed, state, subplebbitAddress, timestamp } = post || {};
@@ -442,11 +441,12 @@ const PostInfo = ({
{cid &&
!parentCid &&
isInPostPageView &&
cidToReply &&
[...new Set<string>((post?.quotedCids || []) as string[])].map((quotedCid) => {
const reply = cidToReply.get(quotedCid);
return reply?.cid && !(reply.deleted || reply.removed) && <ReplyQuotePreview key={`op-bl-${reply.cid}`} isBacklinkReply={true} backlinkReply={reply} />;
})}
quotedByMap
?.get(cid)
?.map(
(reply: Comment) =>
reply?.cid && !(reply?.deleted || reply?.removed) && <ReplyQuotePreview key={`op-bl-${reply.cid}`} isBacklinkReply={true} backlinkReply={reply} />,
)}
</span>
</div>
);
@@ -690,14 +690,6 @@ const PostDesktop = ({
return map;
}, [filteredReplies, numberToCid]);
const cidToReply = useMemo(() => {
const map = new Map<string, Comment>();
for (const reply of filteredReplies) {
if (reply.cid) map.set(reply.cid, reply);
}
return map;
}, [filteredReplies]);
// Virtuoso scroll position management for infinite replies
const virtuosoRef = useRef<VirtuosoHandle | null>(null);
const virtuosoStateKey = `replies-desktop-${cid}`;
@@ -786,7 +778,7 @@ const PostDesktop = ({
isPublishing={isPublishing}
onApprove={onApprove}
onReject={onReject}
cidToReply={cidToReply}
quotedByMap={quotedByMap}
/>
{!isHidden && !content && !(deleted || removed) && <div className={styles.spacer} />}
{!isHidden && <CommentContent comment={post} />}