feat: lazy load dashboard

This commit is contained in:
Kieran 2023-12-07 16:45:01 +00:00
parent 0897f406ca
commit 3f8742238b
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -2,7 +2,7 @@ import "@szhsin/react-menu/dist/index.css";
import "./index.css"; import "./index.css";
import "./fonts/outfit/outfit.css"; import "./fonts/outfit/outfit.css";
import React from "react"; import React, { Suspense, lazy } from "react";
import ReactDOM from "react-dom/client"; import ReactDOM from "react-dom/client";
import { NostrSystem } from "@snort/system"; import { NostrSystem } from "@snort/system";
import { SnortContext } from "@snort/system-react"; import { SnortContext } from "@snort/system-react";
@ -26,7 +26,7 @@ import { IntlProvider } from "@/intl";
import { WidgetsPage } from "@/pages/widgets"; import { WidgetsPage } from "@/pages/widgets";
import { AlertsPage } from "@/pages/alerts"; import { AlertsPage } from "@/pages/alerts";
import { StreamSummaryPage } from "@/pages/summary"; import { StreamSummaryPage } from "@/pages/summary";
import DashboardPage from "./pages/dashboard"; const DashboardPage = lazy(() => import("./pages/dashboard"));
export enum StreamState { export enum StreamState {
Live = "live", Live = "live",
@ -102,7 +102,9 @@ const router = createBrowserRouter([
}, },
{ {
path: "/dashboard", path: "/dashboard",
element: <DashboardPage />, element: <Suspense>
<DashboardPage />
</Suspense>,
}, },
{ {
path: "*", path: "*",