From ed6961fb60b1c8d8bcc109e4bc85eb7eb8c6bd33 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Jan 2026 11:59:46 +0000 Subject: [PATCH] fix: hide zap reply previews for missing or non-chat events Only show reply previews for zaps when: 1. The replied-to event exists in the event store 2. The replied-to event is a chat kind (9, 9321, or 1311) This prevents showing loading states or reply previews for zaps replying to events we don't have or non-chat events. --- src/components/ChatViewer.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/ChatViewer.tsx b/src/components/ChatViewer.tsx index 188f4fa..2a265d7 100644 --- a/src/components/ChatViewer.tsx +++ b/src/components/ChatViewer.tsx @@ -269,6 +269,19 @@ const MessageItem = memo(function MessageItem({ zapRequest?.tags.find((t) => t[0] === "e")?.[1] || undefined; + // Check if the replied-to event exists and is a chat kind + const replyEvent = use$( + () => (zapReplyTo ? eventStore.event(zapReplyTo) : undefined), + [zapReplyTo], + ); + + // Only show reply preview if: + // 1. The event exists in our store + // 2. The event is a chat kind (9, 9321, 1311) + const chatKinds = [9, 9321, 1311]; + const shouldShowReplyPreview = + zapReplyTo && replyEvent && chatKinds.includes(replyEvent.kind); + return (
- {zapReplyTo && ( + {shouldShowReplyPreview && (