From dd3ca845bfaf901dfb0fe702a7e5cb1c32485d25 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 10 Sep 2026 10:40:16 -0700 Subject: Onboarding: fix the crash after a name claim/migration; keep a login-owned name through signer resume. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Something broke" right after a coinos.io migration completed: the spend step advances past the avatar ask by calling nextAfterAvatar(), which was a const declared further down the same function — a temporal-dead-zone throw for any profile that already had a picture. Now a hoisted function. Also, the claimed-name ownership check only counted the LIVE login signer. A bunker/Google login resumes seconds after load, so for that window a name owned by the login identity (every migrated coinos.io name) looked foreign, was dropped, and the wallet key's npub-shaped default took its place — the address visibly flipped from name@coinos.io to npub…@coinos.io. The stored login pubkey now counts as ours too. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01Nw1Dijik1tLVKRM1WkU7xE --- src/features/names.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/features/names.js') diff --git a/src/features/names.js b/src/features/names.js index cdcbfbf..7a0f0de 100644 --- a/src/features/names.js +++ b/src/features/names.js @@ -207,7 +207,14 @@ export function namesFeature(ctx) { const r = await withTimeout( fetch(`${REGISTRAR}/name/${encodeURIComponent(st.name)}?domain=${encodeURIComponent(st.domain || DOMAIN())}`).then((x) => x.json()), 8000, 'registrar'); - const mine = new Set([wallet.nostrPubkey && wallet.nostrPubkey(), (hook('nostrLoginIdentity') || {}).pubkey].filter(Boolean)); + // The linked login identity counts even while its signer hasn't + // resumed yet (a bunker/Google login comes back seconds after + // load): its pubkey is on record. Without this, a name owned by + // the login identity — every migrated coinos.io name — was judged + // "not ours" in that window, dropped, and replaced by the wallet + // key's npub-shaped default: the name visibly flipped to npub… + const stored = (() => { try { return (wallet.loadFeatureState('nostrlogin', {}) || {}).pubkey; } catch { return null; } })(); + const mine = new Set([wallet.nostrPubkey && wallet.nostrPubkey(), (hook('nostrLoginIdentity') || {}).pubkey, stored].filter(Boolean)); const ours = r && r.taken && (mine.has(r.pubkey) || mine.has(r.manager)); if (r && !ours) { save({}); st = load(); render(); } } catch {} -- cgit v1.2.3