From e2aa10741a12329c1e5c28cd3887638e194ec3fc Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 27 Jun 2026 16:42:04 -0700 Subject: Fix stuck 'Scanning…' — auto-scans no longer touch the visible flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The visible spScanning state is now set only for manual scans; auto-scans use a separate concurrency guard (_spScanBusy). Previously an auto-scan set spScanning and the final emit fired before it was cleared (and silent scans skipped the clearing emit), leaving the Receive card stuck on 'Scanning…'. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/wallet.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/wallet.js b/src/wallet.js index 212c471..3255048 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -311,9 +311,11 @@ export class Wallet { const keys = this.silentPaymentKeys(); const indexer = spIndexerUrl(this.netName); if (!keys || !indexer || this.offline) return { unavailable: true }; - if (this.spScanning) return { busy: true }; - this.spScanning = true; - if (!silent) this.emit(); // manual scans show a "Scanning…" state; auto-scans stay quiet + if (this._spScanBusy) return { busy: true }; + this._spScanBusy = true; + // Only a manual scan shows the visible "Scanning…" state; auto-scans are + // invisible (setting spScanning for them left the card stuck on "Scanning…"). + if (!silent) { this.spScanning = true; this.emit(); } try { if (rescan) { this.spUtxos = []; this.lastSpScan = 0; } const from = (this.lastSpScan || 0) + 1; @@ -347,11 +349,11 @@ export class Wallet { await this._refreshSpUtxos(); this._recomputeBalanceFromChains(); // fold found SP value into the displayed balance this.saveCache(); - this.emit(); return { found: found.length, scanned: tip }; } finally { + this._spScanBusy = false; this.spScanning = false; - if (!silent) this.emit(); + this.emit(); // always refresh (balance + clears any "Scanning…") } } -- cgit v1.2.3