From 0eaf30cd8b77ff485469e93bc56da7f386c3d37d Mon Sep 17 00:00:00 2001 From: Chad Curtis Date: Wed, 1 Apr 2026 03:36:26 -0500 Subject: [PATCH] Fix threaded replies: only show first child inline, hide siblings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The linear threading UI (connector lines) only works for single chains. When a reply had multiple children, siblings after the first rendered without any visual connection to their parent, making them look like top-level replies. Fix by only including the first child in each node's thread chain — additional siblings are hidden since there is no UI to display branching threads. --- src/pages/PostDetailPage.tsx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/pages/PostDetailPage.tsx b/src/pages/PostDetailPage.tsx index 7083b113..3b4ef2e5 100644 --- a/src/pages/PostDetailPage.tsx +++ b/src/pages/PostDetailPage.tsx @@ -1184,18 +1184,24 @@ function PostDetailContent({ event }: { event: NostrEvent }) { } } - const buildNode = (ev: NostrEvent): ReplyNode => ({ - event: ev, - children: (childrenMap.get(ev.id) ?? []).map(buildNode), - }); + const buildNode = (ev: NostrEvent): ReplyNode => { + const firstChild = (childrenMap.get(ev.id) ?? [])[0]; + return { + event: ev, + children: firstChild ? [buildNode(firstChild)] : [], + }; + }; return directReplies.map(buildNode); } // Kind 1111 or non-kind-1 root: use NIP-22 comment structure - const buildNode = (ev: NostrEvent): ReplyNode => ({ - event: ev, - children: (commentsData?.getDirectReplies(ev.id) ?? []).map(buildNode), - }); + const buildNode = (ev: NostrEvent): ReplyNode => { + const firstChild = (commentsData?.getDirectReplies(ev.id) ?? [])[0]; + return { + event: ev, + children: firstChild ? [buildNode(firstChild)] : [], + }; + }; if (isComment) { const directReplies = commentsData?.getDirectReplies(event.id) ?? [];