Lazy load notification and keep-online providers

Introduced NotificationProviderWrapper to dynamically load the notification context only on dashboard pages, reducing initial bundle size. KeepOnline component is now also lazy-loaded. Updated app layout to use the new wrapper.
This commit is contained in:
g
2025-12-31 07:11:10 +00:00
parent 2777cfda0b
commit 37a8cfed82
4 changed files with 47 additions and 8 deletions

View File

@@ -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({
<html lang="en" suppressHydrationWarning className="dark">
<body className={inter.className}>
<ThemeProvider attribute="class" defaultTheme="dark" enableSystem disableTransitionOnChange>
<NotificationProvider>
<NotificationProviderWrapper>
{/* Christmas decorations disabled */}
<Toaster
theme="dark"
@@ -87,7 +87,7 @@ export default function RootLayout({
/>
<KeepOnlineWrapper />
{children}
</NotificationProvider>
</NotificationProviderWrapper>
</ThemeProvider>
</body>
</html>