mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-24 19:58:37 +00:00
⚡️ perf: Defer Visactor chart libs to dashboard; minimize home bundle
Home started loading `/assets/visactor-*.js` due to static imports of `@visactor/react-vchart` and the Semi theme in dashboard components/hooks. This change moves chart dependencies to lazy/dynamic imports so they load only on dashboard routes. Changes - StatsCards.jsx: replace static `VChart` import with `React.lazy` + `Suspense` (fallback: null) - ChartsPanel.jsx: replace static `VChart` import with `React.lazy` + `Suspense` (fallback: null) - useDashboardCharts.js: remove static `initVChartSemiTheme` import; dynamically import and initialize the theme inside `useEffect` with a cancel guard Behavior - Home page no longer downloads `visactor` chunks on first load - Chart libraries are fetched only when visiting `/console` (dashboard) - No functional changes to chart rendering Files - web/src/components/dashboard/StatsCards.jsx - web/src/components/dashboard/ChartsPanel.jsx - web/src/hooks/dashboard/useDashboardCharts.js Verification - Build the app (`npm run build`) and open `/`: no `/assets/visactor-*.js` requests - Navigate to `/console`: `visactor` chunks load and charts render as expected Breaking Changes - None Follow-ups - If needed, further trim homepage bundle by reducing heavy icon sets on the hero section
This commit is contained in:
@@ -106,7 +106,7 @@ const NotificationSettings = ({
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
{() => (
|
||||
<Tabs type="line" defaultActiveKey="notification">
|
||||
<Tabs type="card" defaultActiveKey="notification">
|
||||
{/* 通知配置 Tab */}
|
||||
<TabPane
|
||||
tab={
|
||||
|
||||
Reference in New Issue
Block a user