From 6ed0b50d331c744acbb8669393e7a47cad6371de Mon Sep 17 00:00:00 2001 From: Jure <44338+hoornet@users.noreply.github.com> Date: Mon, 30 Mar 2026 08:19:18 +0200 Subject: [PATCH] Fix article bookmarks using note-style e tag instead of a tag ArticleView was using addBookmark(eventId) which saves an e tag, putting articles in the Notes tab. Now uses addArticleBookmark with the 30023:pubkey:d-tag address so articles appear correctly under the Articles tab in bookmarks. --- src/components/article/ArticleView.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/article/ArticleView.tsx b/src/components/article/ArticleView.tsx index e1f38ec..268a36f 100644 --- a/src/components/article/ArticleView.tsx +++ b/src/components/article/ArticleView.tsx @@ -79,7 +79,7 @@ export function ArticleView() { const [showComment, setShowComment] = useState(false); const [commentText, setCommentText] = useState(""); const autoResize = useAutoResize(3, 10); - const { isBookmarked, addBookmark, removeBookmark } = useBookmarkStore(); + const { isBookmarked, addBookmark, removeBookmark, isArticleBookmarked, addArticleBookmark, removeArticleBookmark } = useBookmarkStore(); const naddr = pendingArticleNaddr ?? ""; @@ -127,7 +127,9 @@ export function ArticleView() { const bodyHtml = event?.content ? renderMarkdown(event.content) : ""; const wordCount = event?.content?.trim().split(/\s+/).length ?? 0; const readingTime = Math.max(1, Math.ceil(wordCount / 230)); - const bookmarked = event?.id ? isBookmarked(event.id) : false; + const dTag = event?.tags?.find((t) => t[0] === "d")?.[1]; + const articleAddr = event && dTag ? `30023:${event.pubkey}:${dTag}` : null; + const bookmarked = articleAddr ? isArticleBookmarked(articleAddr) : (event?.id ? isBookmarked(event.id) : false); // Reading progress bar + TOC const scrollRef = useRef(null); @@ -198,9 +200,14 @@ export function ArticleView() { }; const handleBookmark = () => { - if (!event?.id) return; - if (bookmarked) removeBookmark(event.id); - else addBookmark(event.id); + if (!event) return; + if (articleAddr) { + if (bookmarked) removeArticleBookmark(articleAddr); + else addArticleBookmark(articleAddr); + } else if (event.id) { + if (bookmarked) removeBookmark(event.id); + else addBookmark(event.id); + } }; const handleRepost = async () => {