From 1a848174530e6daccc50d703ba20b1f9cef23d44 Mon Sep 17 00:00:00 2001 From: Gigi Date: Wed, 8 Oct 2025 10:02:04 +0100 Subject: [PATCH] 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 --- src/services/webBookmarkService.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/services/webBookmarkService.ts b/src/services/webBookmarkService.ts index 99611341..99159e45 100644 --- a/src/services/webBookmarkService.ts +++ b/src/services/webBookmarkService.ts @@ -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 }