From 0781c4ebfc10af7a1bae442d31d228da10e5729e Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 23 Oct 2025 16:28:50 +0200 Subject: [PATCH] fix: fetch all writings in background on /my/writings page Add background fetch effect to Me component to populate event store with all writings without limits, matching the behavior of Profile component. This ensures all writings are displayed on /my/writings page. --- src/components/Me.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/Me.tsx b/src/components/Me.tsx index 3737c097..604c870a 100644 --- a/src/components/Me.tsx +++ b/src/components/Me.tsx @@ -14,7 +14,7 @@ import { highlightsController } from '../services/highlightsController' import { writingsController } from '../services/writingsController' import { fetchLinks } from '../services/linksService' import { ReadItem, readsController } from '../services/readsController' -import { BlogPostPreview } from '../services/exploreService' +import { BlogPostPreview, fetchBlogPostsFromAuthors } from '../services/exploreService' import { Bookmark, IndividualBookmark } from '../types/bookmarks' import AuthorCard from './AuthorCard' import BlogPostCard from './BlogPostCard' @@ -33,6 +33,7 @@ import { deriveLinksFromBookmarks } from '../utils/linksFromBookmarks' import { readingProgressController } from '../services/readingProgressController' import { archiveController } from '../services/archiveController' import { UserSettings } from '../services/settingsService' +import { getActiveRelayUrls } from '../services/relayManager' interface MeProps { relayPool: RelayPool @@ -130,6 +131,17 @@ const Me: React.FC = ({ } }, []) + // Background fetch to populate event store with ALL writings (non-blocking) + useEffect(() => { + if (!viewingPubkey || !relayPool || !eventStore) return + + // Fetch all writings in background without limits + const relayUrls = getActiveRelayUrls(relayPool) + + fetchBlogPostsFromAuthors(relayPool, [viewingPubkey], relayUrls, undefined, null, eventStore) + .catch(err => console.warn('⚠️ [Me] Failed to fetch writings:', err)) + }, [viewingPubkey, relayPool, eventStore, refreshTrigger]) + // Sync filter state with URL changes useEffect(() => { const normalized = urlFilter === 'emoji' ? 'archive' : urlFilter