mirror of
https://github.com/dergigi/boris.git
synced 2026-01-05 16:04:36 +01:00
fix: prevent useBookmarksData from overwriting external URL highlights
The issue was that useBookmarksData was fetching general highlights whenever there was no naddr, which included external URL routes (/r/*). This caused the URL-specific highlights loaded by useExternalUrlLoader to be overwritten after a couple seconds. Now we skip fetching general highlights when viewing external URLs, letting useExternalUrlLoader manage those highlights instead.
This commit is contained in:
@@ -167,6 +167,7 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
||||
activeAccount,
|
||||
accountManager,
|
||||
naddr,
|
||||
externalUrl,
|
||||
currentArticleCoordinate,
|
||||
currentArticleEventId,
|
||||
settings
|
||||
|
||||
@@ -13,6 +13,7 @@ interface UseBookmarksDataParams {
|
||||
activeAccount: IAccount | undefined
|
||||
accountManager: AccountManager
|
||||
naddr?: string
|
||||
externalUrl?: string
|
||||
currentArticleCoordinate?: string
|
||||
currentArticleEventId?: string
|
||||
settings?: UserSettings
|
||||
@@ -23,6 +24,7 @@ export const useBookmarksData = ({
|
||||
activeAccount,
|
||||
accountManager,
|
||||
naddr,
|
||||
externalUrl,
|
||||
currentArticleCoordinate,
|
||||
currentArticleEventId,
|
||||
settings
|
||||
@@ -115,11 +117,13 @@ export const useBookmarksData = ({
|
||||
// Fetch highlights/contacts independently to avoid disturbing bookmarks
|
||||
useEffect(() => {
|
||||
if (!relayPool || !activeAccount) return
|
||||
if (!naddr) {
|
||||
// Only fetch general highlights when not viewing an article (naddr) or external URL
|
||||
// External URLs have their highlights fetched by useExternalUrlLoader
|
||||
if (!naddr && !externalUrl) {
|
||||
handleFetchHighlights()
|
||||
}
|
||||
handleFetchContacts()
|
||||
}, [relayPool, activeAccount, naddr, handleFetchHighlights, handleFetchContacts])
|
||||
}, [relayPool, activeAccount, naddr, externalUrl, handleFetchHighlights, handleFetchContacts])
|
||||
|
||||
return {
|
||||
bookmarks,
|
||||
|
||||
Reference in New Issue
Block a user