1"use client"; 2 3import { QueryClientProvider as TanstackQueryClientProvider } from "@tanstack/react-query"; 4import { useMemo, type ReactNode } from "react"; 5import { makeQueryClient } from "@/lib/query-client"; 6 7/** 8 * Client component boundary around the QueryClient so a fresh instance is 9 * created per browser session (module-level singletons leak across SSR 10 * requests in dev). Server state policy lives in lib/query-client.ts. 11 * 12 * The tanstack export is aliased (TASK-0100 S5): defining this wrapper with 13 * the same name shadows it, so `<QueryClientProvider …>` on the line below 14 * self-referenced the wrapper (build error "defined multiple times" / would 15 * be infinite recursion at runtime). 16 */ 17export function QueryClientProvider({ children }: { children: ReactNode }) { 18 const queryClient = useMemo(() => makeQueryClient(), []); 19 return <TanstackQueryClientProvider client={queryClient}>{children}</TanstackQueryClientProvider>; 20} 21