Pin group reads to app relay

This commit is contained in:
lemon
2026-05-28 01:53:19 -07:00
parent 01d98fa7bb
commit 9465eb2215
2 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -2,6 +2,7 @@ import { useNostr } from '@nostrify/react';
import { useQuery } from '@tanstack/react-query';
import type { NostrEvent } from '@nostrify/nostrify';
import { DITTO_RELAY } from '@/lib/appRelays';
import {
COMMUNITY_DEFINITION_KIND,
parseCommunityEvent,
@@ -29,11 +30,12 @@ interface UseDiscoverCommunitiesOptions {
export function useDiscoverCommunities(options: UseDiscoverCommunitiesOptions = {}) {
const { limit = 24 } = options;
const { nostr } = useNostr();
const relay = nostr.relay(DITTO_RELAY);
return useQuery<ParsedCommunity[]>({
queryKey: ['discover-communities', limit],
queryFn: async ({ signal }) => {
const events = await nostr.query(
const events = await relay.query(
[{ kinds: [COMMUNITY_DEFINITION_KIND], limit }],
{ signal },
);
@@ -65,4 +67,3 @@ export function useDiscoverCommunities(options: UseDiscoverCommunitiesOptions =
staleTime: 60_000,
});
}
+3 -1
View File
@@ -3,6 +3,7 @@ import { useQuery } from '@tanstack/react-query';
import type { NostrEvent, NostrFilter } from '@nostrify/nostrify';
import { useOrganizationModeration } from '@/hooks/useOrganizationModeration';
import { DITTO_RELAY } from '@/lib/appRelays';
import {
COMMUNITY_DEFINITION_KIND,
parseCommunityEvent,
@@ -49,6 +50,7 @@ function parseCoord(coord: string): { pubkey: string; dTag: string } | null {
*/
export function useFeaturedOrganizations() {
const { nostr } = useNostr();
const relay = nostr.relay(DITTO_RELAY);
const { data: moderation, isReady: moderationReady } = useOrganizationModeration();
// Derive the curated coord set: featured minus hidden, sorted by the
@@ -101,7 +103,7 @@ export function useFeaturedOrganizations() {
);
const combinedSignal = AbortSignal.any([signal, AbortSignal.timeout(8000)]);
const events = await nostr.query(filters, { signal: combinedSignal });
const events = await relay.query(filters, { signal: combinedSignal });
// Latest-wins dedupe of addressable revisions, then index by coord so
// we can return them in the moderator-controlled `featuredOrder`.