From 6f28c3906c7a91dc2e89c47a99e5fc89e09f1a51 Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 5 Oct 2025 12:37:28 +0100 Subject: [PATCH] fix: show highlights for nostr articles by skipping URL filter The HighlightsPanel was filtering out ALL highlights that didn't have a urlReference. But Nostr article highlights reference the article via the 'a' tag (article coordinate), not a URL. Since we already fetch highlights specifically for the current article using fetchHighlightsForArticle(), we don't need to filter them again. Solution: - Skip URL filtering when selectedUrl starts with 'nostr:' - Keep URL filtering for web articles (backwards compatible) - Highlights are already pre-filtered by the fetch query This fixes the issue where 101 highlights existed for the default article but weren't being displayed in the UI. --- src/components/HighlightsPanel.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/HighlightsPanel.tsx b/src/components/HighlightsPanel.tsx index 06255c22..4f0c7e3e 100644 --- a/src/components/HighlightsPanel.tsx +++ b/src/components/HighlightsPanel.tsx @@ -37,10 +37,17 @@ export const HighlightsPanel: React.FC = ({ onToggleUnderlines?.(newValue) } - // Filter highlights to show only those relevant to the current URL + // Filter highlights to show only those relevant to the current URL or article const filteredHighlights = useMemo(() => { if (!selectedUrl) return highlights + // For Nostr articles (URL starts with "nostr:"), we don't need to filter + // because we already fetched highlights specifically for this article + if (selectedUrl.startsWith('nostr:')) { + return highlights + } + + // For web URLs, filter by URL matching const normalizeUrl = (url: string) => { try { const urlObj = new URL(url.startsWith('http') ? url : `https://${url}`)