// components/QueryProvider.tsx // Wraps the app in TanStack Query's QueryClientProvider. Lives high // in the tree so all client components can call useQuery / useMutation. "use client"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { useState } from "react"; export default function QueryProvider({ children }: { children: React.ReactNode }) { const [client] = useState( () => new QueryClient({ defaultOptions: { queries: { staleTime: 30_000, refetchOnWindowFocus: false, retry: 1 } } }) ); return {children}; }