- Standardized import statements and formatting in various files for better code clarity. - Enhanced error messages and logging for improved debugging and user experience. - Adjusted whitespace and line breaks in multiple components to follow best practices. - Updated environment variable handling and configuration for consistency across services.
26 lines
803 B
TypeScript
26 lines
803 B
TypeScript
"use client";
|
|
|
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
import dynamic from "next/dynamic";
|
|
import { queryClient } from "@/lib/query-client";
|
|
|
|
interface QueryProviderProps {
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export function QueryProvider({ children }: QueryProviderProps) {
|
|
const enableDevtools =
|
|
process.env.NEXT_PUBLIC_ENABLE_DEVTOOLS === "true" && process.env.NODE_ENV !== "production";
|
|
const ReactQueryDevtools = enableDevtools
|
|
? dynamic(() => import("@tanstack/react-query-devtools").then(m => m.ReactQueryDevtools), {
|
|
ssr: false,
|
|
})
|
|
: null;
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
{children}
|
|
{enableDevtools && ReactQueryDevtools ? <ReactQueryDevtools initialIsOpen={false} /> : null}
|
|
</QueryClientProvider>
|
|
);
|
|
}
|