This commit is contained in:
yangy
2026-05-26 19:16:42 +08:00
parent 47ea7d7b56
commit 517036439c
4 changed files with 69 additions and 42 deletions
+7 -2
View File
@@ -1,4 +1,5 @@
import AIPage from "@/pages/AIPage";
import { lazy, Suspense } from "react";
import PageLoader from "@/components/PageLoader";
import { useAIDrawer } from "@/contexts/AIDrawerContext";
import { useIsLgUp } from "@/hooks/useIsLgUp";
import { cn } from "@/lib/utils";
@@ -11,6 +12,8 @@ import {
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)} />
<Suspense fallback={<PageLoader />}>
<AIPage variant="split" onClose={() => setOpen(false)} />
</Suspense>
</div>
</>
)}
+8
View File
@@ -0,0 +1,8 @@
/** Lightweight fallback while lazy-loaded routes fetch their chunks. */
export default function PageLoader() {
return (
<div className="flex min-h-[40vh] items-center justify-center">
<span className="text-sm text-white/40">Loading</span>
</div>
);
}