diff --git a/src/views/Community/components/StockDetailPanel/hooks/useEventStocks.js b/src/views/Community/components/StockDetailPanel/hooks/useEventStocks.js index 35e5f427..0e7867ae 100644 --- a/src/views/Community/components/StockDetailPanel/hooks/useEventStocks.js +++ b/src/views/Community/components/StockDetailPanel/hooks/useEventStocks.js @@ -126,9 +126,14 @@ export const useEventStocks = (eventId, eventTime, { autoLoad = true, autoLoadQu // 自动加载行情数据(可通过 autoLoadQuotes 参数控制) useEffect(() => { if (stocks.length > 0 && autoLoadQuotes) { - refreshQuotes(); + const codes = stocks.map(s => s.stock_code); + logger.debug('useEventStocks', '自动加载行情数据', { + stockCount: codes.length, + eventTime + }); + dispatch(fetchStockQuotes({ codes, eventTime })); } - }, [stocks.length, eventId, autoLoadQuotes]); // 注意:这里不依赖 refreshQuotes,避免重复请求 + }, [stocks, eventTime, autoLoadQuotes, dispatch]); // 直接使用 stocks 而不是 refreshQuotes // 计算股票行情合并数据 const stocksWithQuotes = useMemo(() => {