Prewarm user's follow list, speed up discover plugins hook

This commit is contained in:
Alex Gleason committed 2025-12-04 20:42:46 -06:00
1 parent 67fc846ba3
commit 720aba0ff7
2 files changed
+6 -4

No files matched your search

+4
View File
@@ -2,6 +2,7 @@ import { useEffect } from 'react';
import { useNostr } from '@nostrify/react';
import { useCurrentUser } from '@/hooks/useCurrentUser';
import { useAppContext } from '@/hooks/useAppContext';
import { useContacts } from '@/hooks/useContacts';
/**
* NostrSync - Syncs user's Nostr data
@@ -15,6 +16,9 @@ export function NostrSync() {
const { user } = useCurrentUser();
const { config, updateConfig } = useAppContext();
// Prewarm user's follow list
useContacts(user?.pubkey);
useEffect(() => {
if (!user) return;
+2 -4
View File
@@ -26,9 +26,7 @@ export function useDiscoverPlugins() {
return useQuery({
queryKey: ['discover-plugins', user?.pubkey, contacts],
queryFn: async (c) => {
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
queryFn: async () => {
// Build authors list: current user + people they follow
const authors: string[] = [];
if (user?.pubkey) {
@@ -54,7 +52,7 @@ export function useDiscoverPlugins() {
limit: 100,
},
],
{ signal }
{ signal: AbortSignal.timeout(3000) }
);
// Transform events into DiscoveredPlugin objects