Files
ember-market-frontend/components/layout/KeepOnlineWrapper.tsx
g 37a8cfed82 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.
2025-12-31 07:11:10 +00:00

22 lines
563 B
TypeScript

"use client";
import { usePathname } from "next/navigation";
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();
// Don't show KeepOnline on admin pages or non-dashboard pages
if (!pathname?.includes("/dashboard") || pathname?.includes("/dashboard/admin")) {
return null;
}
return <KeepOnline />;
};
export default KeepOnlineWrapper;