Merge pull request #48 from Permissionless-Software-Foundation/ct-unstable

fix(feeds): Removing duplicate posts
This commit is contained in:
Chris Troutner
2025-08-06 19:49:30 -07:00
committed by GitHub
+15 -2
View File
@@ -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'] })
})