From c4357ab5563aacc3614bfaf8f54cfb5c79a7f1ba Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 2 Sep 2026 18:56:04 -0700 Subject: Recipient search warms its pipes on focus, not first keystroke: the Primal cache socket, the registrar's TLS session, and the NIP-50 relay connections each cost a handshake that used to land on the first query — the cold second of dead air. Touching the send recipient field, opening user search, or unfolding New message now pre-opens all three (throttled; the idle reaper still closes the socket a minute after real use) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01MrkLsNScXe9b6BviUSdmMr --- src/app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/app.js') diff --git a/src/app.js b/src/app.js index a818d67..da724dc 100644 --- a/src/app.js +++ b/src/app.js @@ -6,7 +6,7 @@ import { Wallet, newMnemonic, isValidMnemonic, accountXpubFor, cacheKeyFor, utxoId, parseExtendedKey, xpubToZpub, encryptVault, decryptVault } from './wallet.js'; import { qrSvg } from './qr.js'; -import { makeSearcher, resultRows, searchable, punkUrl } from './recipient-search.js'; +import { makeSearcher, resultRows, searchable, punkUrl, warmSearch } from './recipient-search.js'; import { npubOf } from './nostr.js'; import { nip98Header } from './nip98.js'; import { NOSTR_MARK } from './features/nostrlogin.js'; @@ -3870,8 +3870,10 @@ function recipientRow(s, r, i) { type: 'text', class: 'mono-input grow', placeholder: i === 0 ? t('destPlaceholder') : 'bc1q…', autocapitalize: 'none', autocomplete: 'off', spellcheck: 'false', value: r.address, // the delay lets the keyboard start opening (and any render() swap of - // this input) before parkSendField measures the live activeElement - onFocus: () => setTimeout(parkSendField, 300), + // this input) before parkSendField measures the live activeElement. + // warmSearch pre-opens the search transports so the first keystroke's + // results don't pay three cold handshakes. + onFocus: () => { warmSearch(); setTimeout(parkSendField, 300); }, onInput: (e) => { const v = e.target.value; r.address = v; syncCheck(); -- cgit v1.2.3