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