LayoutContent

This commit is contained in:
Ishaan Jaffer 2026-02-19 18:05:35 -08:00
parent fc6c1f0de6
commit 4e7a19baa0

View file

@ -6,6 +6,7 @@ import { ThemeProvider } from "@/contexts/ThemeContext";
import Sidebar2 from "@/app/(dashboard)/components/Sidebar2";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
import { useRouter, useSearchParams } from "next/navigation";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
/** ---- BASE URL HELPERS ---- */
function normalizeBasePrefix(raw: string | undefined | null): string {
@ -22,7 +23,7 @@ function withBase(path: string): string {
}
/** -------------------------------- */
function LayoutContent({ children }: { children: React.ReactNode }) {
function DashboardContent({ children }: { children: React.ReactNode }) {
const router = useRouter();
const searchParams = useSearchParams();
const { accessToken, userRole, userId, userEmail, premiumUser } = useAuthorized();
@ -72,6 +73,16 @@ function LayoutContent({ children }: { children: React.ReactNode }) {
);
}
function LayoutContent({ children }: { children: React.ReactNode }) {
const [queryClient] = useState(() => new QueryClient());
return (
<QueryClientProvider client={queryClient}>
<DashboardContent>{children}</DashboardContent>
</QueryClientProvider>
);
}
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<Suspense fallback={<div className="flex items-center justify-center min-h-screen">Loading...</div>}>