aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/app.js10
-rw-r--r--src/features/names.js9
2 files changed, 16 insertions, 3 deletions
diff --git a/src/app.js b/src/app.js
index 35fd225..9bedd2c 100644
--- a/src/app.js
+++ b/src/app.js
@@ -2879,10 +2879,16 @@ function onboardScreen() {
// After the identity niceties: offer a first top-up when Savings can fund
// one and Spending is empty-handed — a spending account with nothing in it
// is a demo, not a wallet.
- const nextAfterAvatar = () =>
- (featureHook('arkReady') && wallet.spendable > 1000
+ // A function declaration, not a const: the spend step above calls this
+ // while advancing past the avatar ask, i.e. BEFORE this line runs — a
+ // const there is in its temporal dead zone and threw "Cannot access
+ // before initialization", crashing onboarding right after a name claim or
+ // a coinos.io migration landed (a profile with a picture took this path).
+ function nextAfterAvatar() {
+ return (featureHook('arkReady') && wallet.spendable > 1000
&& (featureHook('spendingSat') || 0) + (featureHook('spendingBoardingSat') || 0) < 1000)
? 'board' : 'success';
+ }
if (o.step === 'legacy') {
// The migrate link carries this wallet's payment address, which the
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 {}