From af30d3cdc7da7f9e60bc552282f08ea7def3c0dd Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 7 Oct 2026 08:10:18 -0700 Subject: Profiles: a remembered face beats a row asked for before the cache opened Since the profile cache moved to IndexedDB, a profile asked for during boot (a restored profile page, offline or with relays failing) left a loading or miss row in memory, and the re-warm after the cache opened skipped any pk already present, so the cached name never showed (profile-draft-test: the editor reopened with an empty Display name). Placeholder rows without a name/picture (and without a real kind 0 behind them) now give way to the cached one. Co-Authored-By: Claude Opus 5.5 --- src/features/messages.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/features/messages.js b/src/features/messages.js index f98df3a..9745717 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -645,7 +645,13 @@ export function messagesFeature(ctx) { if (!wallet.mnemonic && !wallet.xprv && !wallet.xpub) return; profilesWarmed = true; const cached = profilesDisk(); - for (const [pk, p] of Object.entries(cached)) if (!profiles.has(pk)) profiles.set(pk, p); + // (a row asked for before the cache opened — still loading, or a miss + // while offline — gives way to the remembered face; a kind 0 that + // really named nothing keeps its say) + for (const [pk, p] of Object.entries(cached)) { + const cur = profiles.get(pk); + if (!cur || (!cur.name && !cur.picture && !cur.eventAt)) profiles.set(pk, p); + } // someone known to have no face paints their punk from the first frame, // instead of a blank circle that turns into one when the relays answer for (const [pk, t] of Object.entries(facelessDisk())) { -- cgit v1.2.3