fix(agent,trader): guard nil TargetRef in skill handlers and fix toast indentation

- Add nil checks for session.TargetRef in all four execute*Action handlers
  (Trader/Exchange/Model/Strategy) to prevent panic on corrupted sessions;
  actions that don't need a target (query/query_list/create) are excluded.
- Fix toast.success indentation in handleToggleTrader so success messages
  only fire when the API call actually succeeds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shinchan-zhai
2026-04-26 00:00:26 +08:00
parent 4cadf6f442
commit 132fd93072
2 changed files with 26 additions and 2 deletions

View File

@@ -298,10 +298,10 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) {
try {
if (running) {
await api.stopTrader(traderId)
toast.success(t('aiTradersToast.stopped', language))
toast.success(t('aiTradersToast.stopped', language))
} else {
await api.startTrader(traderId)
toast.success(t('aiTradersToast.started', language))
toast.success(t('aiTradersToast.started', language))
}
await mutateTraders()