diff options
| author | Adam Soltys <[email protected]> | 2026-06-27 16:42:04 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-27 16:42:04 -0700 |
| commit | e2aa10741a12329c1e5c28cd3887638e194ec3fc (patch) | |
| tree | efb78ca7ba0e33cfdf62381af384203870605053 /src/wallet.js | |
| parent | 588159a38bf2a2e9cae4d5b8a8ff7faae8b9ad2a (diff) | |
| download | coinosv3-e2aa10741a12329c1e5c28cd3887638e194ec3fc.tar.gz coinosv3-e2aa10741a12329c1e5c28cd3887638e194ec3fc.zip | |
Fix stuck 'Scanning…' — auto-scans no longer touch the visible flag
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) <[email protected]>
Diffstat (limited to 'src/wallet.js')
| -rw-r--r-- | src/wallet.js | 12 |
1 files changed, 7 insertions, 5 deletions
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…") } } |
