mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 19:52:09 +01:00
- Implement comprehensive tRPC setup with type-safe API - Create tRPC routers for dashboard, admin, and auth endpoints - Migrate frontend components to use tRPC client - Fix platform dashboard Settings button functionality - Add platform settings page with profile and security management - Create OpenAI API mocking infrastructure for cost-safe testing - Update tests to work with new tRPC architecture - Sync database schema to fix AIBatchRequest table errors
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
/**
|
|
* tRPC Provider Component
|
|
*
|
|
* Simplified provider for tRPC integration.
|
|
* The tRPC client is configured in trpc-client.ts and used directly in components.
|
|
*/
|
|
|
|
"use client";
|
|
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
import { useState } from "react";
|
|
|
|
interface TRPCProviderProps {
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export function TRPCProvider({ children }: TRPCProviderProps) {
|
|
const [queryClient] = useState(
|
|
() =>
|
|
new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
// Disable automatic refetching for better UX
|
|
refetchOnWindowFocus: false,
|
|
refetchOnReconnect: true,
|
|
staleTime: 30 * 1000, // 30 seconds
|
|
gcTime: 5 * 60 * 1000, // 5 minutes (was cacheTime)
|
|
},
|
|
},
|
|
})
|
|
);
|
|
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
{children}
|
|
{process.env.NODE_ENV === "development" && (
|
|
<ReactQueryDevtools initialIsOpen={false} />
|
|
)}
|
|
</QueryClientProvider>
|
|
);
|
|
}
|