From fc5dbc3e80e69c3cba7aceba02a56ac47f4b97bf Mon Sep 17 00:00:00 2001 From: Chad Curtis Date: Sat, 28 Feb 2026 16:19:22 -0600 Subject: [PATCH] Pass relay and author hints from nevent1 to EmbeddedNote MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a nostr:nevent1 URI is decoded in NoteContent, the relay hints and author pubkey embedded in the identifier were being discarded. This meant EmbeddedNote would only query the user's configured relays and skip the relay hints, causing quoted events hosted on other relays to silently fail to load. Now the hints are stored in the nevent-embed token and forwarded to EmbeddedNote → useEvent. --- src/components/EmbeddedNote.tsx | 8 ++++++-- src/components/NoteContent.tsx | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/EmbeddedNote.tsx b/src/components/EmbeddedNote.tsx index d865d447..1ed5f6b9 100644 --- a/src/components/EmbeddedNote.tsx +++ b/src/components/EmbeddedNote.tsx @@ -61,6 +61,10 @@ function parseEmbedSegments(text: string): EmbedSegment[] { interface EmbeddedNoteProps { /** Hex event ID to fetch and display. */ eventId: string; + /** Optional relay hints from the nevent1 identifier. */ + relays?: string[]; + /** Optional author pubkey hint from the nevent1 identifier. */ + authorHint?: string; className?: string; /** When true, ProfileHoverCards inside the card are disabled to prevent nested hover cards. */ disableHoverCards?: boolean; @@ -70,8 +74,8 @@ interface EmbeddedNoteProps { const MAX_CONTENT_LENGTH = 280; /** Inline embedded note card – similar to a link preview but for Nostr events. */ -export function EmbeddedNote({ eventId, className, disableHoverCards }: EmbeddedNoteProps) { - const { data: event, isLoading, isError } = useEvent(eventId); +export function EmbeddedNote({ eventId, relays, authorHint, className, disableHoverCards }: EmbeddedNoteProps) { + const { data: event, isLoading, isError } = useEvent(eventId, relays, authorHint); if (isLoading) { return ; diff --git a/src/components/NoteContent.tsx b/src/components/NoteContent.tsx index f4d11f1d..5888600f 100644 --- a/src/components/NoteContent.tsx +++ b/src/components/NoteContent.tsx @@ -152,7 +152,7 @@ type ContentToken = | { type: 'inline-link'; url: string } | { type: 'youtube-embed'; videoId: string } | { type: 'mention'; pubkey: string } - | { type: 'nevent-embed'; eventId: string } + | { type: 'nevent-embed'; eventId: string; relays?: string[]; author?: string } | { type: 'naddr-embed'; addr: AddrCoords; url?: string } | { type: 'nostr-link'; id: string; raw: string } | { type: 'hashtag'; tag: string; raw: string }; @@ -296,7 +296,12 @@ export function NoteContent({ } else if (decoded.type === 'note') { result.push({ type: 'nevent-embed', eventId: decoded.data as string }); } else if (decoded.type === 'nevent') { - result.push({ type: 'nevent-embed', eventId: (decoded.data as { id: string }).id }); + result.push({ + type: 'nevent-embed', + eventId: decoded.data.id, + relays: decoded.data.relays, + author: decoded.data.author, + }); } else if (decoded.type === 'naddr') { result.push({ type: 'naddr-embed', addr: decoded.data as AddrCoords }); } else { @@ -446,7 +451,7 @@ export function NoteContent({ case 'youtube-embed': return ; case 'nevent-embed': - return ; + return ; case 'naddr-embed': return (