fix: 预加载行业数据(解决第一次点击无数据问题)

This commit is contained in:
zdl
2025-12-04 12:33:59 +08:00
parent f521b89c27
commit 3f518def09

View File

@@ -93,6 +93,13 @@ const CompactSearchBox = ({
loadStocks(); loadStocks();
}, []); }, []);
// 预加载行业数据(解决第一次点击无数据问题)
useEffect(() => {
if (!industryData || industryData.length === 0) {
dispatch(fetchIndustryData());
}
}, [dispatch, industryData]);
// 初始化筛选条件 // 初始化筛选条件
const findIndustryPath = useCallback((targetCode, data, currentPath = []) => { const findIndustryPath = useCallback((targetCode, data, currentPath = []) => {
if (!data || data.length === 0) return null; if (!data || data.length === 0) return null;