fix: Rebuild conversations on startup from stored gift wraps

InboxViewer conversations weren't loading automatically on page reload because
updateConversations() was only called:
1. When gift wraps change from pending to unlocked (not already decrypted)
2. After sync fetches from relays (requires manual refresh)

Now updateConversations() is called immediately after loading stored gift wraps
from Dexie, so conversations appear instantly without needing to click refresh.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gómez
2026-01-16 13:06:08 +01:00
parent 34847bc7ab
commit a7e1746cf9

View File

@@ -203,6 +203,13 @@ class GiftWrapService {
for (const event of storedEvents) {
eventStore.add(event);
}
// Update conversations from loaded gift wraps (they're already decrypted from cache)
// Without this, conversations don't appear until sync fetches from relays
this.updateConversations();
console.log(
`[GiftWrap] Rebuilt conversations from ${storedEvents.length} stored gift wraps`,
);
}
} catch (err) {
console.warn(`[GiftWrap] Error loading stored gift wraps:`, err);