aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-07 08:10:18 -0700
committerAdam Soltys <[email protected]>2026-10-07 08:10:18 -0700
commitaf30d3cdc7da7f9e60bc552282f08ea7def3c0dd (patch)
treeb95a3998bb1983e6fab12a271d666952d9a247f0 /src/features
parent9a49107afe8cf7104ea7da1638e680518fa55bb8 (diff)
downloadcoinosv3-af30d3cdc7da7f9e60bc552282f08ea7def3c0dd.tar.gz
coinosv3-af30d3cdc7da7f9e60bc552282f08ea7def3c0dd.zip
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 <[email protected]>
Diffstat (limited to 'src/features')
-rw-r--r--src/features/messages.js8
1 files changed, 7 insertions, 1 deletions
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())) {