mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 15:14:20 +01:00
fix: stop highlights loading spinner when article has no highlights
This commit is contained in:
@@ -229,13 +229,15 @@ export function useArticleLoader({
|
|||||||
// Fetch highlights after content is shown
|
// Fetch highlights after content is shown
|
||||||
try {
|
try {
|
||||||
if (!mountedRef.current) return
|
if (!mountedRef.current) return
|
||||||
setHighlightsLoading(true)
|
|
||||||
setHighlights([])
|
|
||||||
const le = latestEvent as NostrEvent | null
|
const le = latestEvent as NostrEvent | null
|
||||||
const dTag = le ? (le.tags.find((t: string[]) => t[0] === 'd')?.[1] || '') : ''
|
const dTag = le ? (le.tags.find((t: string[]) => t[0] === 'd')?.[1] || '') : ''
|
||||||
const coord = le && dTag ? `${le.kind}:${le.pubkey}:${dTag}` : undefined
|
const coord = le && dTag ? `${le.kind}:${le.pubkey}:${dTag}` : undefined
|
||||||
const eventId = le ? le.id : undefined
|
const eventId = le ? le.id : undefined
|
||||||
|
|
||||||
if (coord && eventId) {
|
if (coord && eventId) {
|
||||||
|
setHighlightsLoading(true)
|
||||||
|
setHighlights([])
|
||||||
await fetchHighlightsForArticle(
|
await fetchHighlightsForArticle(
|
||||||
relayPool,
|
relayPool,
|
||||||
coord,
|
coord,
|
||||||
@@ -251,6 +253,10 @@ export function useArticleLoader({
|
|||||||
},
|
},
|
||||||
settingsRef.current
|
settingsRef.current
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
// No article event to fetch highlights for - clear and don't show loading
|
||||||
|
setHighlights([])
|
||||||
|
setHighlightsLoading(false)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to fetch highlights:', err)
|
console.error('Failed to fetch highlights:', err)
|
||||||
|
|||||||
Reference in New Issue
Block a user