Revert "️ perf: Defer Visactor chart libs to dashboard; minimize home bundle"

This reverts commit b67a42e0a8.
This commit is contained in:
t0ng7u
2025-08-17 10:49:09 +08:00
parent 3749be3e09
commit a6ad49dba0
6 changed files with 46 additions and 60 deletions

View File

@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/
import { useState, useCallback, useEffect } from 'react';
import { initVChartSemiTheme } from '@visactor/vchart-semi-theme';
import {
modelColorMap,
renderNumber,
@@ -417,19 +418,9 @@ export const useDashboardCharts = (
// ========== 初始化图表主题 ==========
useEffect(() => {
// 动态加载 visactor 主题,避免首页首屏加载
let canceled = false;
(async () => {
try {
const mod = await import('@visactor/vchart-semi-theme');
if (!canceled && mod?.initVChartSemiTheme) {
mod.initVChartSemiTheme({ isWatchingThemeSwitch: true });
}
} catch (e) {
// 忽略加载失败,图表页再尝试
}
})();
return () => { canceled = true; };
initVChartSemiTheme({
isWatchingThemeSwitch: true,
});
}, []);
return {