Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/components/dashboard-page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
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 load wallet connector UI to reduce initial bundle size
const ConnectWalletButton = lazy(() => import("./connect-wallet.tsx").then(mod => ({ default: mod.ConnectWalletButton })));

// Loading skeleton for wallet button
const WalletButtonSkeleton = () => (
<div className="wallet-button skeleton" style={{ width: "180px", height: "40px" }} />
);

const LogoSpan = () => <span id="header-logo-wrapper">{ICONS.DAO_LOGO}</span>;

export function DashboardPage() {
Expand All @@ -26,7 +34,9 @@ export function DashboardPage() {
</h1>
</div>

<ConnectWalletButton />
<Suspense fallback={<WalletButtonSkeleton />}>
<ConnectWalletButton />
</Suspense>
</section>

{/* Status Displays */}
Expand Down
21 changes: 21 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ export default defineConfig({
build: {
cssCodeSplit: false,
outDir: "dist",
rollupOptions: {
output: {
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",
Expand Down
Loading