From 7064a5b282f1c8e8d6d3e5fa614013c32921454f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 28 Aug 2026 08:23:20 -0700 Subject: The address is fetched while the key still turns in the lock: sign-in races a registrar lookup against the seed work and seeds the name before first paint, so the Receive pane opens straight onto its QR instead of "setting up your payment address" Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi --- src/features/nostrlogin.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/features/nostrlogin.js') diff --git a/src/features/nostrlogin.js b/src/features/nostrlogin.js index 6c0889b..cef1628 100644 --- a/src/features/nostrlogin.js +++ b/src/features/nostrlogin.js @@ -89,6 +89,8 @@ export function nostrLoginFeature(ctx) { // warm the identity's profile + avatar in parallel with the seed work, // so the home screen's first paint already has the picture ctx.hook('warmProfile', signer.pubkey); + // and the payment name too — the Receive pane should open with its QR + const nameHintP = ctx.hook('namesLookupByPk', signer.pubkey); const res = await walletForSigner(signer); if (res.mode === 'new') { // No wallet on this identity yet — make one and walk straight in. @@ -111,7 +113,12 @@ export function nostrLoginFeature(ctx) { // re-animated the welcome screen for a beat before the wallet appeared ctx.onbNostrLogin(res.mode === 'restored'); ui.navAnimSkip = true; // the handover swaps instantly, no fade - await ctx.openMnemonic(res.mnemonic, res.passphrase || '', { nostrPubkey: signer.pubkey, spendingHint }); + // usually resolved long ago; the race caps a slow registrar at 1.5s + const nameHint = await Promise.race([ + Promise.resolve(nameHintP).catch(() => null), + new Promise((r) => setTimeout(() => r(null), 1500)), + ]); + await ctx.openMnemonic(res.mnemonic, res.passphrase || '', { nostrPubkey: signer.pubkey, spendingHint, nameHint }); save({ ...load(), pubkey: signer.pubkey, linked: Date.now(), ...sessionOf(signer) }); attaching = false; // claim the real npub as the payment address while this signer is live -- cgit v1.2.3