From d148433fcc2f352446df2cd0c13158f967a40d3f Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 5 Oct 2025 21:45:47 +0100 Subject: [PATCH] fix(content): render markdown immediately while computing highlights; prevent initial login refresh from overwriting article highlights --- src/components/Bookmarks.tsx | 6 +++++- src/components/ContentPanel.tsx | 13 +++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/Bookmarks.tsx b/src/components/Bookmarks.tsx index 432fd684..200843dd 100644 --- a/src/components/Bookmarks.tsx +++ b/src/components/Bookmarks.tsx @@ -77,7 +77,11 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { useEffect(() => { if (!relayPool || !activeAccount) return handleFetchBookmarks() - handleFetchHighlights() + // Avoid overwriting article-specific highlights during initial article load + // If an article is being viewed (naddr present), let useArticleLoader own the first highlights set + if (!naddr) { + handleFetchHighlights() + } handleFetchContacts() }, [relayPool, activeAccount?.pubkey]) diff --git a/src/components/ContentPanel.tsx b/src/components/ContentPanel.tsx index 5e3b507f..e38e0f73 100644 --- a/src/components/ContentPanel.tsx +++ b/src/components/ContentPanel.tsx @@ -76,7 +76,6 @@ const ContentPanel: React.FC = ({ // Check if we need to wait for HTML conversion const needsHtmlConversion = markdown && !renderedHtml - const shouldShowContent = !needsHtmlConversion || relevantHighlights.length === 0 // Attach click handlers to highlight marks useEffect(() => { @@ -188,11 +187,11 @@ const ContentPanel: React.FC = ({ )} {markdown || html ? ( - finalHtml || (markdown && shouldShowContent) ? ( + markdown ? ( finalHtml ? (
) : ( @@ -205,7 +204,13 @@ const ContentPanel: React.FC = ({
) - ) : null + ) : ( +
+ ) ) : (

No readable content found for this URL.