Assist_Design/apps/portal/src/providers/query-provider.tsx
tema 05817e8c67 Refactor code for improved readability and consistency across components
- 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.
2025-09-09 15:45:03 +09:00

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>
);
}