diff options
| author | Adam Soltys <[email protected]> | 2026-08-26 12:06:00 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-26 12:06:00 -0700 |
| commit | 0427a1b02c21fd5fa9f5df8a86e435dbb84a8451 (patch) | |
| tree | 32e5601682e6f65e46a8811cfc2ea7184ba17119 /src/features | |
| parent | 6be9a45c4d085988c8bfaf210df762dbc83c8ab1 (diff) | |
| download | coinosv3-0427a1b02c21fd5fa9f5df8a86e435dbb84a8451.tar.gz coinosv3-0427a1b02c21fd5fa9f5df8a86e435dbb84a8451.zip | |
The page arrives light and paints at once: index.html shrinks to 46KB with a static boot shell baked in — brand row, and the profile frame when the path names one — while the 789KB bundle moves to a content-addressed app-<hash>.js the browser keeps (a repeat visit re-downloads kilobytes, not the app); the nostr-tools barrel import goes subpath, and the NIP-46 signer client ships as its own lazy file fetched on first bunker login
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi
Diffstat (limited to 'src/features')
| -rw-r--r-- | src/features/nostrlogin.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/features/nostrlogin.js b/src/features/nostrlogin.js index 5195778..9c4156f 100644 --- a/src/features/nostrlogin.js +++ b/src/features/nostrlogin.js @@ -162,11 +162,19 @@ export function nostrLoginFeature(ctx) { // from another device); when the app connects, login continues by itself. let nc = null; let ncRun = null; - function startNostrConnect(run) { + let ncToken = null; // guards the async gap while the nip46 module loads + async function startNostrConnect(run) { if (nc) nc.cancel(); ncRun = run; - nc = nostrConnect(); - const mine = nc; + const token = (ncToken = {}); + let mine; + try { mine = await nostrConnect(); } catch { + if (token === ncToken && ui.nostrConnectOpen) { ui.nostrConnectOpen = false; render(); } + return; + } + if (token !== ncToken || !ncRun) { mine.cancel(); return; } + nc = mine; + render(); mine.ready.then((signer) => { if (nc !== mine || !ncRun) return; ui.nostrConnectOpen = false; @@ -179,6 +187,7 @@ export function nostrLoginFeature(ctx) { function stopNostrConnect() { if (nc) { nc.cancel(); nc = null; } ncRun = null; + ncToken = null; } function nostrConnectSection(run) { @@ -188,7 +197,9 @@ export function nostrLoginFeature(ctx) { onClick: () => { ui.nostrConnectOpen = true; startNostrConnect(run); render(); }, }, t('nlConnectApp')); } - if (!nc) return null; + // the nip46 module is still fetching — hold the spot with a spinner + if (!nc) return h('div', { class: 'row gap6', style: 'align-items:center;justify-content:center;padding:8px' }, + h('span', { class: 'spinner sm' })); return h('div', { class: 'col', style: 'gap:10px;align-items:center' }, h('a', { class: 'btn btn-block btn-primary', href: nc.uri, |
