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.
This commit is contained in:
Claude
2026-01-15 11:59:46 +00:00
parent 571e7a0d14
commit ed6961fb60

View File

@@ -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 (
<div className="pl-2 my-1">
<div
@@ -300,7 +313,7 @@ const MessageItem = memo(function MessageItem({
<Timestamp timestamp={message.timestamp} />
</span>
</div>
{zapReplyTo && (
{shouldShowReplyPreview && (
<ReplyPreview
replyToId={zapReplyTo}
adapter={adapter}