aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-15 21:45:11 -0700
committerAdam Soltys <[email protected]>2026-09-15 21:45:11 -0700
commit3ff00c59bbe350642b23e8b3527b0d07b16bee0e (patch)
tree0b7fff02b6fa875c21336f7616f0616dfec8a9e4
parent88636e5c158c9e390eec25c4471207780857abeb (diff)
downloadcoinosv3-3ff00c59bbe350642b23e8b3527b0d07b16bee0e.tar.gz
coinosv3-3ff00c59bbe350642b23e8b3527b0d07b16bee0e.zip
Cached faces warm from the wallet's own namespace, once its keys are in.
On the phone the profile cache was intact — 150 faces, our own with a thumbnail — yet an offline boot drew a punk in the header. The header asks for a face before a silent sign-in has finished resuming, and the warm-up ran then: it read an empty slot under a keyless namespace and counted itself done. Online the relays refilled the map and nobody saw it; offline nothing did. The warm-up now waits for the wallet's keys and runs again at feature init, from the right namespace. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JuwQqNWtDJcxPWtEm9134z
-rw-r--r--src/features/messages.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index cb63e04..429c8fc 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -525,6 +525,13 @@ export function messagesFeature(ctx) {
let profilesWarmed = false;
function warmProfiles() {
if (profilesWarmed) return;
+ // The cache lives under the WALLET's namespace. The header avatar can
+ // ask for a face before the wallet has its keys (a silent sign-in still
+ // resuming at boot), and warming then read an empty slot under a bogus
+ // key and counted itself done — online the relays papered over it, but
+ // offline every cached face stayed a punk. Wait for the keys; init()
+ // warms again once they're there.
+ if (!wallet.mnemonic && !wallet.xprv && !wallet.xpub) return;
profilesWarmed = true;
const cached = wallet.loadFeatureState('profiles', {});
for (const [pk, p] of Object.entries(cached)) if (!profiles.has(pk)) profiles.set(pk, p);
@@ -6632,6 +6639,10 @@ export function messagesFeature(ctx) {
h('span', { class: big ? '' : 'small' }, displayName(pk)));
},
init() {
+ // this wallet's cached faces, from its own namespace — the keys are
+ // in place now, whatever the header asked for before
+ profilesWarmed = false;
+ warmProfiles();
// your own profile is the likeliest first tap — warm it early
setTimeout(() => {
try { const me = ctx.shownPubkey && ctx.shownPubkey(); if (me) prefetchProfilePage(me); } catch {}