Refactor AIPage and EQPage components to use lazy loading with PageSuspense for improved performance; update vite.config.ts to adjust chunking strategy and increase chunk size warning limit for better handling of large libraries.

This commit is contained in:
yangy
2026-05-27 18:07:36 +08:00
parent b59a7bb583
commit e6b7dcc89c
5 changed files with 70 additions and 44 deletions
+7 -2
View File
@@ -1,4 +1,4 @@
import AIPage from "@/pages/AIPage";
import PageSuspense from "@/components/PageSuspense";
import { useAIDrawer } from "@/contexts/AIDrawerContext";
import { useIsLgUp } from "@/hooks/useIsLgUp";
import { cn } from "@/lib/utils";
@@ -7,10 +7,13 @@ import {
useCallback,
useEffect,
useRef,
lazy,
type ReactNode,
type RefObject,
} from "react";
const AIPage = lazy(() => import("@/pages/AIPage"));
function SplitDivider({
containerRef,
onResize,
@@ -114,7 +117,9 @@ export default function DesktopAIShell({ children }: { children: ReactNode }) {
className="flex h-full min-h-0 min-w-0 flex-col overflow-hidden border-l border-white/[0.08] bg-[#0d1117]"
style={{ flex: `${splitPercent} 1 0%` }}
>
<AIPage variant="split" onClose={() => setOpen(false)} />
<PageSuspense>
<AIPage variant="split" onClose={() => setOpen(false)} />
</PageSuspense>
</div>
</>
)}