From 2a6fb97a43f188bc9cd5ed0ba5f96dd73c05a1b1 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Feb 2026 12:38:58 +0000 Subject: [PATCH] fix: prevent page scroll jump on data refresh - silent reload + fixed container heights --- frontend/app/trades/page.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/app/trades/page.tsx b/frontend/app/trades/page.tsx index 6d451e1..304dc84 100644 --- a/frontend/app/trades/page.tsx +++ b/frontend/app/trades/page.tsx @@ -93,12 +93,12 @@ function LiveTrades({ symbol }: { symbol: Symbol }) { ▼ 红=主动卖(空方发动)

-
+
{loading ? (
加载中...
) : ( - + @@ -133,7 +133,7 @@ function FlowAnalysis({ symbol }: { symbol: Symbol }) { const [loading, setLoading] = useState(true); const [dataAge, setDataAge] = useState(0); // 数据积累分钟数 - const fetchData = useCallback(async () => { + const fetchData = useCallback(async (showLoading = false) => { const end_ms = Date.now(); const windowMs = { "1m": 3600000, "5m": 14400000, "15m": 43200000, "1h": 172800000 }[interval]; const start_ms = end_ms - windowMs; @@ -145,7 +145,7 @@ function FlowAnalysis({ symbol }: { symbol: Symbol }) { const json = await res.json(); const bars: SummaryBar[] = json.data || []; setData(bars); - setLoading(false); + if (showLoading) setLoading(false); if (bars.length > 0) { const ageMs = end_ms - bars[0].time_ms; setDataAge(Math.round(ageMs / 60000)); @@ -155,8 +155,8 @@ function FlowAnalysis({ symbol }: { symbol: Symbol }) { useEffect(() => { setLoading(true); - fetchData(); - const iv = setInterval(fetchData, 30000); + fetchData(true); + const iv = setInterval(() => fetchData(false), 30000); // 定时刷新不触发loading return () => clearInterval(iv); }, [fetchData]);
价格 数量