From 59cfecb485b7b534c25c19d095020b54c112825c Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Wed, 6 Aug 2025 19:48:09 -0700 Subject: [PATCH] fix(feeds): Removing duplicate posts --- src/components/app-body/nostr/feeds/index.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/app-body/nostr/feeds/index.js b/src/components/app-body/nostr/feeds/index.js index 3f1971c..0c8e022 100644 --- a/src/components/app-body/nostr/feeds/index.js +++ b/src/components/app-body/nostr/feeds/index.js @@ -1,5 +1,16 @@ /* Component for reading the nostr feeds. + + TODO: + - fetchProfile() should retrieve a profile from multiple relays. If the first relay returns a profile, + then that profile can be used and promise resolved. If the first relay returns no profile, the next + one should be tried until all relays are exhausted or one returns a profile. + + - useEffect() retrieves the feeds. This should cycle through each relay and posts from each one. + Once each relays has been tried, the posts should remove duplicate entries. Finally posts should + be sorted by date. + + - Clicking on a profile picture, name, or npub should open the profile for that user in a new tab. */ // Global npm libraries @@ -37,7 +48,8 @@ function Feeds (props) { }) if (hasProfileRequest) return - const pool = RelayPool(config.nostrRelays) + // const pool = RelayPool(config.nostrRelays) + const pool = RelayPool([config.nostrRelay]) pool.on('open', relay => { relay.subscribe('subid', { limit: 5, kinds: [0], authors: [pubkey] }) }) @@ -78,7 +90,8 @@ function Feeds (props) { // Get global feed posts useEffect(() => { const start = () => { - const pool = RelayPool(config.nostrRelays) + // const pool = RelayPool(config.nostrRelays) + const pool = RelayPool([config.nostrRelay]) pool.on('open', relay => { relay.subscribe('REQ', { limit: 10, kinds: [1], '#t': ['slpdex-socialmedia'] }) })