fix: resolve highlight loading issues for articles

- Add missing eventStore parameter to fetchHighlightsForArticle call
- Clear highlights immediately when starting to load new article
- Fix infinite loading spinners when articles have zero highlights
- Ensure highlights are properly stored and persisted
This commit is contained in:
Gigi
2025-10-25 00:52:49 +02:00
parent 04dea350a4
commit 465c24ed3a

View File

@@ -76,6 +76,10 @@ export function useArticleLoader({
setSelectedUrl(`nostr:${naddr}`) setSelectedUrl(`nostr:${naddr}`)
setIsCollapsed(true) setIsCollapsed(true)
// Clear highlights immediately when starting to load a new article
setHighlights([])
setHighlightsLoading(false) // Don't show loading yet
// If we have preview data from navigation, show it immediately (no skeleton!) // If we have preview data from navigation, show it immediately (no skeleton!)
if (previewData) { if (previewData) {
setReaderContent({ setReaderContent({
@@ -251,7 +255,9 @@ export function useArticleLoader({
return next.sort((a, b) => b.created_at - a.created_at) return next.sort((a, b) => b.created_at - a.created_at)
}) })
}, },
settingsRef.current settingsRef.current,
false, // force
eventStore || undefined
) )
} else { } else {
// No article event to fetch highlights for - clear and don't show loading // No article event to fetch highlights for - clear and don't show loading