aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.js4
-rw-r--r--src/features/ark.js9
2 files changed, 12 insertions, 1 deletions
diff --git a/src/app.js b/src/app.js
index 82cf537..d13dda7 100644
--- a/src/app.js
+++ b/src/app.js
@@ -3239,6 +3239,7 @@ function viewLabel(a, view) {
return view === 'spending' ? t('spendingName') : t('savingsName');
}
function switchToView(id, view) {
+ ui.accountUserChosen = true; // deliberate pick from the accounts screen
ui.account = view;
try { localStorage.setItem(ACCOUNT_KEY, view); } catch {}
if (id === activeId) { ui.screen = 'wallet'; ui.tab = 'history'; render(); }
@@ -3263,6 +3264,7 @@ let _accDir = null; // which way the balance face should slide in
let _accAnim = false; // whether the current face switch animates (decided at the switch)
function setAccountSel(a, dir) {
if (ui.account === a) return;
+ ui.accountUserChosen = true; // deliberate pick — auto-select must not override
_accDir = dir || (a === 'savings' ? 'left' : 'right');
ui.account = a;
try { localStorage.setItem(ACCOUNT_KEY, a); } catch {}
@@ -3419,6 +3421,7 @@ function balanceCard() {
// the scroll already rests on this card — mark it aligned so the
// post-render pass skips its layout read instead of re-aligning
el._alignedTo = view;
+ ui.accountUserChosen = true; // a deliberate pick — no auto-select behind it
ui.account = view;
try { localStorage.setItem(ACCOUNT_KEY, view); } catch {}
// selecting an account lands on its history (home), any open
@@ -3534,6 +3537,7 @@ function balanceCard() {
if (e.target.closest && e.target.closest('button, a, input')) return;
const strip = e.currentTarget.parentNode;
if (strip && Date.now() - (strip._dragged || 0) < 300) return;
+ ui.accountUserChosen = true; // deliberate pick
ui.account = v;
try { localStorage.setItem(ACCOUNT_KEY, v); } catch {}
ui.txDetail = null; ui.arkMoveDetail = null; ui.arkReconDetail = null; ui.arkExitDetail = null; ui.giftDetail = null;
diff --git a/src/features/ark.js b/src/features/ark.js
index a421dfb..30ecd51 100644
--- a/src/features/ark.js
+++ b/src/features/ark.js
@@ -496,6 +496,13 @@ export function arkFeature(ctx) {
let _autoSelected = false;
function maybeAutoSelectSpending() {
if (_autoSelected || wallet.watchOnly) return;
+ // The user beat us to it: they've already scrolled/tapped/flicked to an
+ // account this session. The "open onto Spending when Savings is empty"
+ // convenience only applies to the UNTOUCHED open — arriving late (when
+ // the ark balance finally syncs, a second after a refresh) and yanking
+ // the card away from the one they just chose is the exact opposite of
+ // convenient. Consume the one-shot so it can't fire behind them.
+ if (ui.accountUserChosen) { _autoSelected = true; return; }
const b = arkBalance();
if (!b || b.spendableSat + b.pendingSat <= 0) return;
_autoSelected = true;
@@ -2767,7 +2774,7 @@ export function arkFeature(ctx) {
return {
id: 'ark',
- init() { _autoSelected = false; initArk(); },
+ init() { _autoSelected = false; ui.accountUserChosen = false; initArk(); },
stop() { stopArk(); },
screenView() { return ui.arkCoinsPage ? arkCoinsPage() : ui.arkExitPage ? arkExitPage() : null; },
receiveTakeover() {