diff --git a/src/hooks/useBookmarksData.ts b/src/hooks/useBookmarksData.ts index adec2fae..2eb550f4 100644 --- a/src/hooks/useBookmarksData.ts +++ b/src/hooks/useBookmarksData.ts @@ -106,15 +106,21 @@ export const useBookmarksData = ({ } }, [relayPool, activeAccount, isRefreshing, handleFetchBookmarks, handleFetchHighlights, handleFetchContacts]) - // Load initial data + // Load initial data (avoid clearing on route-only changes) useEffect(() => { if (!relayPool || !activeAccount) return + // Only (re)fetch bookmarks when account or relayPool changes, not on naddr route changes handleFetchBookmarks() + }, [relayPool, activeAccount, handleFetchBookmarks]) + + // Fetch highlights/contacts independently to avoid disturbing bookmarks + useEffect(() => { + if (!relayPool || !activeAccount) return if (!naddr) { handleFetchHighlights() } handleFetchContacts() - }, [relayPool, activeAccount, naddr, handleFetchBookmarks, handleFetchHighlights, handleFetchContacts]) + }, [relayPool, activeAccount, naddr, handleFetchHighlights, handleFetchContacts]) return { bookmarks, diff --git a/src/services/bookmarkService.ts b/src/services/bookmarkService.ts index 1b3346ee..3f461055 100644 --- a/src/services/bookmarkService.ts +++ b/src/services/bookmarkService.ts @@ -73,7 +73,7 @@ export const fetchBookmarks = async ( const bookmarkListEvents = dedupeNip51Events(rawEvents) console.log('📋 After deduplication:', bookmarkListEvents.length, 'bookmark events') if (bookmarkListEvents.length === 0) { - setBookmarks([]) + // Keep existing bookmarks visible; do not clear list if nothing new found return } // Aggregate across events