"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
perf(frontend): route-level lazy loading shrinks initial bundle 688KB → 262KB
warren6180b9b4d8f649b
diff --git a/frontend/src/router.tsx b/frontend/src/router.tsxindex 6d01966e3..c2b7b64e0 100644--- a/frontend/src/router.tsx+++ b/frontend/src/router.tsx@@ -1,18 +1,40 @@+import { Suspense, lazy, type ComponentType } from "react";import { createBrowserRouter } from "react-router-dom";import { Layout } from "@/components/layout/Layout";-import { Home } from "@/pages/Home";-import { Agent } from "@/pages/Agent";-import { RunDetail } from "@/pages/RunDetail";-import { Compare } from "@/pages/Compare";++const Home = lazy(() => import("@/pages/Home").then((m) => ({ default: m.Home })));+const Agent = lazy(() => import("@/pages/Agent").then((m) => ({ default: m.Agent })));+const RunDetail = lazy(() =>+ import("@/pages/RunDetail").then((m) => ({ default: m.RunDetail })),+);+const Compare = lazy(() =>+ import("@/pages/Compare").then((m) => ({ default: m.Compare })),+);++function PageLoader() {+ return (+ <div className="flex h-[60vh] items-center justify-center text-muted-foreground">+ Loading…+ </div>+ );+}++function wrap(Component: ComponentType) {+ return (+ <Suspense fallback={<PageLoader />}>+ <Component />+ </Suspense>+ );+}export const router = createBrowserRouter([{element: <Layout />,children: [- { path: "/", element: <Home /> },- { path: "/agent", element: <Agent /> },- { path: "/runs/:runId", element: <RunDetail /> },- { path: "/compare", element: <Compare /> },+ { path: "/", element: wrap(Home) },+ { path: "/agent", element: wrap(Agent) },+ { path: "/runs/:runId", element: wrap(RunDetail) },+ { path: "/compare", element: wrap(Compare) },],},]);