mirror of
https://github.com/dergigi/boris.git
synced 2026-01-26 10:15:41 +01:00
fix(content): render markdown immediately while computing highlights; prevent initial login refresh from overwriting article highlights
This commit is contained in:
@@ -77,7 +77,11 @@ const Bookmarks: React.FC<BookmarksProps> = ({ 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])
|
||||
|
||||
|
||||
@@ -76,7 +76,6 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
|
||||
|
||||
// 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<ContentPanelProps> = ({
|
||||
</div>
|
||||
)}
|
||||
{markdown || html ? (
|
||||
finalHtml || (markdown && shouldShowContent) ? (
|
||||
markdown ? (
|
||||
finalHtml ? (
|
||||
<div
|
||||
ref={contentRef}
|
||||
className={markdown ? "reader-markdown" : "reader-html"}
|
||||
className="reader-markdown"
|
||||
dangerouslySetInnerHTML={{ __html: finalHtml }}
|
||||
/>
|
||||
) : (
|
||||
@@ -205,7 +204,13 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
|
||||
</ReactMarkdown>
|
||||
</div>
|
||||
)
|
||||
) : null
|
||||
) : (
|
||||
<div
|
||||
ref={contentRef}
|
||||
className="reader-html"
|
||||
dangerouslySetInnerHTML={{ __html: finalHtml || html }}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<div className="reader empty">
|
||||
<p>No readable content found for this URL.</p>
|
||||
|
||||
Reference in New Issue
Block a user