From e6b99490dd2f7f7cd3b0ab7cbc565472d354f4d4 Mon Sep 17 00:00:00 2001 From: Gigi Date: Tue, 21 Oct 2025 23:35:56 +0200 Subject: [PATCH] refactor: simplify profile background fetching - Remove unnecessary .then() callback - Extract relayUrls variable for clarity - Make error handlers consistent - Add clearer comment about no-limit fetching --- src/components/Profile.tsx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/components/Profile.tsx b/src/components/Profile.tsx index 0228f5a0..9b92c40c 100644 --- a/src/components/Profile.tsx +++ b/src/components/Profile.tsx @@ -107,21 +107,14 @@ const Profile: React.FC = ({ useEffect(() => { if (!pubkey || !relayPool || !eventStore) return + // Fetch all highlights and writings in background (no limits) + const relayUrls = getActiveRelayUrls(relayPool) - // Fetch highlights in background fetchHighlights(relayPool, pubkey, undefined, undefined, false, eventStore) - .then(() => { - // Highlights fetched - }) - .catch(err => { - console.warn('⚠️ [Profile] Failed to fetch highlights:', err) - }) + .catch(err => console.warn('⚠️ [Profile] Failed to fetch highlights:', err)) - // Fetch writings in background (no limit for single user profile) - fetchBlogPostsFromAuthors(relayPool, [pubkey], getActiveRelayUrls(relayPool), undefined, null, eventStore) - .catch(err => { - console.warn('⚠️ [Profile] Failed to fetch writings:', err) - }) + fetchBlogPostsFromAuthors(relayPool, [pubkey], relayUrls, undefined, null, eventStore) + .catch(err => console.warn('⚠️ [Profile] Failed to fetch writings:', err)) }, [pubkey, relayPool, eventStore, refreshTrigger]) // Pull-to-refresh