mirror of
https://github.com/dergigi/boris.git
synced 2026-02-09 09:04:38 +01:00
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.
This commit is contained in:
@@ -37,10 +37,17 @@ export const HighlightsPanel: React.FC<HighlightsPanelProps> = ({
|
||||
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}`)
|
||||
|
||||
Reference in New Issue
Block a user