TorbatYar/frontend/components/providers/AppProviders.tsx
Mortezakoohjani 86b37c1de9 Speed up accounting sidebar navigation with shared session cache and prefetch.
Stop refetching /me on every page mount, warm shared accounting queries, prefetch nav routes, and keep the shell visible during soft SPA transitions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 18:31:24 +03:30

30 lines
761 B
TypeScript

"use client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useState, type ReactNode } from "react";
import { Toaster } from "sonner";
export function AppProviders({ children }: { children: ReactNode }) {
const [client] = useState(
() =>
new QueryClient({
defaultOptions: {
queries: {
staleTime: 60_000,
gcTime: 10 * 60_000,
retry: 1,
refetchOnWindowFocus: false,
refetchOnMount: false,
},
},
})
);
return (
<QueryClientProvider client={client}>
{children}
<Toaster position="top-center" dir="rtl" richColors closeButton />
</QueryClientProvider>
);
}