diff --git a/src/hooks/useFavoriteList.ts b/src/hooks/useFavoriteList.ts index 0050f91..5e97d15 100644 --- a/src/hooks/useFavoriteList.ts +++ b/src/hooks/useFavoriteList.ts @@ -9,9 +9,11 @@ import { getSeenRelays } from "applesauce-core/helpers/relays"; import { EventFactory } from "applesauce-core/event-factory"; import eventStore from "@/services/event-store"; import accountManager from "@/services/accounts"; +import settingsManager from "@/services/settings"; import { publishEvent } from "@/services/hub"; import { useAccount } from "@/hooks/useAccount"; import { isAddressableKind } from "@/lib/nostr-kinds"; +import { GRIMOIRE_CLIENT_TAG } from "@/constants/app"; import type { FavoriteListConfig } from "@/config/favorite-lists"; import type { NostrEvent } from "@/types/nostr"; import type { EventPointer, AddressPointer } from "nostr-tools/nip19"; @@ -143,6 +145,11 @@ export function useFavoriteList(config: FavoriteListConfig) { newTags = [...currentTags, buildTag(targetEvent, tagType)]; } + if (settingsManager.getSetting("post", "includeClientTag")) { + newTags = newTags.filter((t) => t[0] !== "client"); + newTags.push(GRIMOIRE_CLIENT_TAG); + } + const factory = new EventFactory({ signer: account.signer }); const built = await factory.build({ kind: config.listKind, diff --git a/src/hooks/useFavoriteListsSync.ts b/src/hooks/useFavoriteListsSync.ts index 2d13ce6..5b36556 100644 --- a/src/hooks/useFavoriteListsSync.ts +++ b/src/hooks/useFavoriteListsSync.ts @@ -1,5 +1,7 @@ import { useEffect } from "react"; import { useAccount } from "./useAccount"; +import { useUserRelays } from "./useUserRelays"; +import { useStableArray } from "./useStable"; import { ALL_FAVORITE_LIST_KINDS } from "@/config/favorite-lists"; import { addressLoader } from "@/services/loaders"; @@ -9,14 +11,21 @@ import { addressLoader } from "@/services/loaders"; */ export function useFavoriteListsSync() { const { pubkey } = useAccount(); + const { outboxRelays } = useUserRelays(pubkey); + const stableRelays = useStableArray(outboxRelays ?? []); useEffect(() => { if (!pubkey) return; const subs = ALL_FAVORITE_LIST_KINDS.map((listKind) => - addressLoader({ kind: listKind, pubkey, identifier: "" }).subscribe(), + addressLoader({ + kind: listKind, + pubkey, + identifier: "", + relays: stableRelays, + }).subscribe(), ); return () => subs.forEach((s) => s.unsubscribe()); - }, [pubkey]); + }, [pubkey, stableRelays]); }