perf: publish bookmarks to relays in background

- Remove await on relayPool.publish() to not block UI
- Bookmark modal now closes immediately after signing
- Publishing happens asynchronously in the background
- Added error handling for failed relay publishes
- Fixes slow save issue caused by waiting for all 12 relays
This commit is contained in:
Gigi
2025-10-08 10:02:04 +01:00
parent a0b98231b7
commit 1a84817453

View File

@@ -75,11 +75,16 @@ export async function createWebBookmark(
// Sign the event
const signedEvent = await factory.sign(draft)
// Publish to relays
await relayPool.publish(relays, signedEvent)
console.log('✅ Web bookmark published:', signedEvent)
// Publish to relays in the background (don't block UI)
relayPool.publish(relays, signedEvent)
.then(() => {
console.log('✅ Web bookmark published to', relays.length, 'relays:', signedEvent)
})
.catch((err) => {
console.warn('⚠️ Some relays failed to publish bookmark:', err)
})
// Return immediately so UI doesn't block
return signedEvent
}