Skip to content

Commit 4b3ffe2

Browse files
Pigbibiclaude
andcommitted
fix(ui): fallback to account defaults when currentStrategies is empty
- currentStrategyForAccount: fallback to default_strategy_profile from account option - currentCashOnlyExecutionForAccount: fallback to platform default - pendingCashOnlyExecution: skip false change for empty accounts Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8e6e531 commit 4b3ffe2

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

web/strategy-switch-console/index.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,7 +2653,12 @@ <h2 data-i18n="summary">切换摘要</h2>
26532653
}
26542654

26552655
function currentCashOnlyExecutionForAccount(platform, account) {
2656-
return cleanOptionalBoolean(currentEntryForAccount(platform, account)?.cash_only_execution);
2656+
const entry = currentEntryForAccount(platform, account);
2657+
if (entry) {
2658+
const val = cleanOptionalBoolean(entry.cash_only_execution);
2659+
if (val !== null) return val;
2660+
}
2661+
return platformCashOnlyExecutionDefault();
26572662
}
26582663

26592664
function currentCashOnlyExecutionText(platform = state.selected, account = selectedAccount(platform)) {
@@ -2789,7 +2794,9 @@ <h2 data-i18n="summary">切换摘要</h2>
27892794
function currentStrategyForAccount(platform, account) {
27902795
const entry = currentEntryForAccount(platform, account);
27912796
const profile = cleanStrategyProfile(entry?.strategy_profile);
2792-
return profile || "";
2797+
if (profile) return profile;
2798+
const fallback = account?.default_strategy_profile || account?.strategy_profile || "";
2799+
return cleanStrategyProfile(fallback);
27932800
}
27942801

27952802
function currentReservePolicyForAccount(platform, account) {
@@ -3526,8 +3533,9 @@ <h2 data-i18n="summary">切换摘要</h2>
35263533
};
35273534
}
35283535
const nextEnabled = mode === "enabled";
3536+
const entry = currentEntryForAccount(platform, account);
35293537
return {
3530-
changed: current !== null && current !== nextEnabled,
3538+
changed: Boolean(entry && current !== null && current !== nextEnabled),
35313539
inputs: { cash_only_execution: nextEnabled },
35323540
};
35333541
}

web/strategy-switch-console/page_asset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)