mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 22:54:30 +01:00
feat: implement smart highlight clearing for articles
- Preserve highlights that belong to the current article when switching articles - Only clear highlights that don't match the current article coordinate or event ID - Improve user experience by maintaining relevant highlights during navigation
This commit is contained in:
@@ -76,8 +76,8 @@ export function useArticleLoader({
|
||||
setSelectedUrl(`nostr:${naddr}`)
|
||||
setIsCollapsed(true)
|
||||
|
||||
// Clear highlights immediately when starting to load a new article
|
||||
setHighlights([])
|
||||
// Don't clear highlights yet - let the smart filtering logic handle it
|
||||
// when we know the article coordinate
|
||||
setHighlightsLoading(false) // Don't show loading yet
|
||||
|
||||
// If we have preview data from navigation, show it immediately (no skeleton!)
|
||||
@@ -241,7 +241,13 @@ export function useArticleLoader({
|
||||
|
||||
if (coord && eventId) {
|
||||
setHighlightsLoading(true)
|
||||
setHighlights([])
|
||||
// Clear highlights that don't belong to this article coordinate
|
||||
setHighlights((prev) => {
|
||||
return prev.filter(h => {
|
||||
// Keep highlights that match this article coordinate or event ID
|
||||
return h.eventReference === coord || h.eventReference === eventId
|
||||
})
|
||||
})
|
||||
await fetchHighlightsForArticle(
|
||||
relayPool,
|
||||
coord,
|
||||
|
||||
Reference in New Issue
Block a user