diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bedebf..5f0d3ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ name: CI on: workflow_dispatch: push: + pull_request: permissions: contents: read diff --git a/.github/workflows/deno-deploy.yml b/.github/workflows/deno-deploy.yml index 8f49850..f32ed4a 100644 --- a/.github/workflows/deno-deploy.yml +++ b/.github/workflows/deno-deploy.yml @@ -2,7 +2,6 @@ name: Deno Deploy on: push: - pull_request: workflow_dispatch: jobs: diff --git a/src/components/dashboard-page.tsx b/src/components/dashboard-page.tsx index 6fc7e4d..7938a58 100644 --- a/src/components/dashboard-page.tsx +++ b/src/components/dashboard-page.tsx @@ -1,10 +1,30 @@ +import { lazy, Suspense } from "react"; import { useAppKitAccount, useAppKitNetwork } from "@reown/appkit/react"; import { ICONS } from "./iconography.tsx"; import { PoolDisplay } from "./pool-display.tsx"; -import { ConnectWalletButton } from "./connect-wallet.tsx"; import { supportedChains } from "../wallet/config.ts"; import { useStatusMessageState } from "../context/status-message.tsx"; +/** + * Lazy-loaded wallet connector button component. + * Dynamically imported to reduce initial bundle size. + * Falls back to skeleton while loading. + */ +const ConnectWalletButton = lazy(() => import("./connect-wallet.tsx").then(mod => ({ default: mod.ConnectWalletButton }))); + +/** + * Loading skeleton placeholder for the wallet button. + * Displayed while the wallet connector is being lazy-loaded. + * @returns {JSX.Element} Skeleton div with placeholder styling + */ +const WalletButtonSkeleton = () => ( +
+); + +/** + * Logo span component displaying the DAO logo. + * @returns {JSX.Element} Span containing the DAO logo icon + */ const LogoSpan = () => {ICONS.DAO_LOGO}; export function DashboardPage() { @@ -26,7 +46,9 @@ export function DashboardPage() {
- + }> + + {/* Status Displays */} diff --git a/vite.config.ts b/vite.config.ts index d6d501e..bce2178 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -13,6 +13,33 @@ export default defineConfig({ build: { cssCodeSplit: false, outDir: "dist", + rollupOptions: { + output: { + /** + * Custom chunking function for vendor splitting. + * Separates heavy dependencies into distinct chunks to reduce initial bundle size. + * @param id - The module ID being evaluated + * @returns {string | undefined} Chunk name if module should be separated, undefined otherwise + */ + manualChunks(id) { + // Separate React + React DOM + if (id.includes("react") && (id.includes("node_modules/react") || id.includes("node_modules/react-dom"))) { + return "vendor-react"; + } + // Separate TanStack Query + if (id.includes("@tanstack/react-query")) { + return "vendor-query"; + } + // Separate wallet libraries + if (id.includes("node_modules/wagmi") || id.includes("node_modules/viem") || id.includes("@reown/appkit")) { + return "vendor-wallet"; + } + }, + chunkFileNames: "assets/[name]-[hash].js", + entryFileNames: "assets/[name]-[hash].js", + assetFileNames: "assets/[name]-[hash].[ext]", + }, + }, }, worker: { format: "es",