diff --git a/src/components/Charts/Stock/MiniTimelineChart.js b/src/components/Charts/Stock/MiniTimelineChart.js index e839fed7..e2235fec 100644 --- a/src/components/Charts/Stock/MiniTimelineChart.js +++ b/src/components/Charts/Stock/MiniTimelineChart.js @@ -44,8 +44,8 @@ const MiniTimelineChart = React.memo(function MiniTimelineChart({ stockCode, eve const loadData = useCallback(() => { if (!stockCode || !mountedRef.current) return false; - // 检查缓存 - const cacheKey = getCacheKey(stockCode, stableEventTime); + // 检查缓存(使用 'minute' 类型) + const cacheKey = getCacheKey(stockCode, stableEventTime, 'minute'); const cachedData = klineDataCache.get(cacheKey); // 如果有缓存数据(包括空数组,表示已请求过但无数据),直接使用 @@ -95,8 +95,8 @@ const MiniTimelineChart = React.memo(function MiniTimelineChart({ stockCode, eve // 检查批量请求的函数 const checkBatchAndLoad = () => { - // 再次检查缓存(批量请求可能已完成) - const cacheKey = getCacheKey(stockCode, stableEventTime); + // 再次检查缓存(批量请求可能已完成,使用 'minute' 类型) + const cacheKey = getCacheKey(stockCode, stableEventTime, 'minute'); const cachedData = klineDataCache.get(cacheKey); if (cachedData !== undefined) { setData(cachedData || []); @@ -106,7 +106,7 @@ const MiniTimelineChart = React.memo(function MiniTimelineChart({ stockCode, eve return true; // 从缓存加载成功 } - const batchKey = `${stableEventTime || 'today'}|timeline`; + const batchKey = `${stableEventTime || 'today'}|minute`; const pendingBatch = batchPendingRequests.get(batchKey); if (pendingBatch) { @@ -150,7 +150,8 @@ const MiniTimelineChart = React.memo(function MiniTimelineChart({ stockCode, eve // 仍然没有批量请求,发起单独请求(备用方案 - 用于非批量加载场景) dataFetchedRef.current = true; - fetchKlineData(stockCode, stableEventTime) + // 使用 'minute' 类型获取分钟线数据 + fetchKlineData(stockCode, stableEventTime, 'minute') .then((result) => { if (mountedRef.current) { setData(result);