diff --git a/app/layout.tsx b/app/layout.tsx
index 2e84c0d..c3a2a37 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -3,9 +3,9 @@ import "./globals.css"
import { ThemeProvider } from "@/components/layout/theme-provider"
import { Toaster } from "sonner"
import type React from "react"
-import { NotificationProvider } from "@/lib/notification-context"
import { Metadata, Viewport } from "next"
import KeepOnlineWrapper from "@/components/layout/KeepOnlineWrapper"
+import { NotificationProviderWrapper } from "@/components/layout/NotificationProviderWrapper"
// Christmas theme disabled
// import { ChristmasDecorations } from "@/components/christmas-decorations"
// import { isDecember } from "@/lib/utils/christmas"
@@ -78,7 +78,7 @@ export default function RootLayout({
-
+
{/* Christmas decorations disabled */}
{children}
-
+
diff --git a/components/layout/KeepOnlineWrapper.tsx b/components/layout/KeepOnlineWrapper.tsx
index 0fba45d..7bc8cf6 100644
--- a/components/layout/KeepOnlineWrapper.tsx
+++ b/components/layout/KeepOnlineWrapper.tsx
@@ -1,7 +1,12 @@
"use client";
import { usePathname } from "next/navigation";
-import KeepOnline from "@/components/KeepOnline";
+import dynamic from "next/dynamic";
+
+// Lazy load KeepOnline component - only needed on dashboard pages
+const KeepOnline = dynamic(() => import("@/components/KeepOnline"), {
+ ssr: false,
+});
const KeepOnlineWrapper = () => {
const pathname = usePathname();
diff --git a/components/layout/NotificationProviderWrapper.tsx b/components/layout/NotificationProviderWrapper.tsx
new file mode 100644
index 0000000..b2dc122
--- /dev/null
+++ b/components/layout/NotificationProviderWrapper.tsx
@@ -0,0 +1,34 @@
+"use client";
+
+import { usePathname } from "next/navigation";
+import dynamic from "next/dynamic";
+import type { ReactNode } from "react";
+
+// Lazy load NotificationProvider - only needed on dashboard pages
+// This saves ~5-10KB from initial bundle since it includes polling logic and API calls
+const NotificationProvider = dynamic(
+ () => import("@/lib/notification-context").then(mod => ({ default: mod.NotificationProvider })),
+ {
+ ssr: false,
+ loading: () => null
+ }
+);
+
+interface NotificationProviderWrapperProps {
+ children: ReactNode;
+}
+
+export function NotificationProviderWrapper({ children }: NotificationProviderWrapperProps) {
+ const pathname = usePathname();
+
+ // Only load NotificationProvider on dashboard pages (but not admin pages)
+ const isDashboardPage = pathname?.includes("/dashboard") && !pathname?.includes("/dashboard/admin");
+
+ if (isDashboardPage) {
+ return {children};
+ }
+
+ // On non-dashboard pages, render children without provider
+ return <>{children}>;
+}
+
diff --git a/package-lock.json b/package-lock.json
index 4c8ce4e..2df5898 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -60,7 +60,7 @@
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.6",
- "zod": "^3.24.1"
+ "zod": "^3.25.0"
},
"devDependencies": {
"@distube/ytdl-core": "^4.16.12",
@@ -10551,9 +10551,9 @@
}
},
"node_modules/zod": {
- "version": "3.24.1",
- "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz",
- "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==",
+ "version": "3.25.76",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
+ "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"