fix(highlights): always publish to all configured relays

Remove relay.connected filter when publishing/rebroadcasting. Now always attempts to publish to all configured relays and lets the relay pool handle connection state management. This ensures highlights are broadcast to all relays, not just those that report as connected at publish time.
This commit is contained in:
Gigi
2025-10-09 16:27:00 +01:00
parent 4239f50129
commit 82f52f73cc
2 changed files with 4 additions and 27 deletions

View File

@@ -114,18 +114,8 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
return
}
// Get all connected relays
const connectedRelays = Array.from(relayPool.relays.values())
.filter(relay => relay.connected)
.map(relay => relay.url)
// Publish to all connected relays
const targetRelays = RELAYS.filter(url => connectedRelays.includes(url))
if (targetRelays.length === 0) {
console.warn('No connected relays to rebroadcast to')
return
}
// Publish to all configured relays - let the relay pool handle connection state
const targetRelays = RELAYS
console.log('📡 Rebroadcasting highlight to', targetRelays.length, 'relay(s):', targetRelays)

View File

@@ -107,21 +107,8 @@ export async function createHighlight(
// Sign the event
const signedEvent = await factory.sign(highlightEvent)
// Get list of currently connected relays from the pool
const connectedRelays = Array.from(relayPool.relays.values())
.filter(relay => relay.connected)
.map(relay => relay.url)
// Determine which relays we're publishing to (intersection of RELAYS and connected relays)
let publishingRelays = RELAYS.filter(url => connectedRelays.includes(url))
// If no relays are connected, try local relay anyway (might still work)
if (publishingRelays.length === 0) {
const localRelays = RELAYS.filter(r => r.includes('localhost') || r.includes('127.0.0.1'))
publishingRelays = localRelays.length > 0 ? localRelays : RELAYS
}
const targetRelays = publishingRelays
// Publish to all configured relays - let the relay pool handle connection state
const targetRelays = RELAYS
// Store the event in the local EventStore FIRST for immediate UI display
eventStore.add(signedEvent)