diff --git a/web/src/App.tsx b/web/src/App.tsx index fbdcb5ff..412d8f16 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -322,10 +322,7 @@ function App() { const selectedTrader = traders?.find((t) => t.trader_id === selectedTraderId) - // When polling has permanently failed, provide zero-value data instead of keeping skeleton - const effectiveAccount = (accountPollOff && !account) - ? { total_equity: 0, available_balance: 0, total_pnl: 0, total_pnl_pct: 0, position_count: 0, margin_used: 0, margin_used_pct: 0 } as AccountInfo - : account + const effectiveAccount = account const effectivePositions = (positionsPollOff && !positions) ? [] as Position[] : positions const effectiveDecisions = (decisionsPollOff && !decisions) ? [] as DecisionRecord[] : decisions @@ -545,6 +542,7 @@ function App() { selectedTrader={selectedTrader} status={status} account={effectiveAccount} + accountFailed={accountPollOff} positions={effectivePositions} decisions={effectiveDecisions} decisionsLimit={decisionsLimit} diff --git a/web/src/pages/TraderDashboardPage.tsx b/web/src/pages/TraderDashboardPage.tsx index b5f9e9d6..ff7386bf 100644 --- a/web/src/pages/TraderDashboardPage.tsx +++ b/web/src/pages/TraderDashboardPage.tsx @@ -103,6 +103,7 @@ interface TraderDashboardPageProps { onNavigateToTraders: () => void status?: SystemStatus account?: AccountInfo + accountFailed?: boolean positions?: Position[] decisions?: DecisionRecord[] decisionsLimit: number @@ -117,6 +118,7 @@ export function TraderDashboardPage({ selectedTrader, status, account, + accountFailed, positions, decisions, decisionsLimit, @@ -488,6 +490,12 @@ export function TraderDashboardPage({ EQ::{account.total_equity?.toFixed(2)} PNL::{account.total_pnl?.toFixed(2)} + ) : accountFailed ? ( +
+ LAST_UPDATE::-- + EQ::-- + PNL::-- +
) : (
@@ -501,37 +509,37 @@ export function TraderDashboardPage({
0} icon="💰" - loading={!account} + loading={!account && !accountFailed} /> = 0 ? '+' : ''}${account?.total_pnl?.toFixed(2) || '0.00'}`} + value={accountFailed && !account ? '--' : `${account?.total_pnl !== undefined && account.total_pnl >= 0 ? '+' : ''}${account?.total_pnl?.toFixed(2) ?? '--'}`} unit="USDT" - change={account?.total_pnl_pct || 0} + change={account ? (account.total_pnl_pct || 0) : undefined} positive={(account?.total_pnl ?? 0) >= 0} icon="📈" - loading={!account} + loading={!account && !accountFailed} />