From 65f6e83f11c82b0ec762e11f3392a80e614ee69a Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 1 Feb 2026 12:29:54 +0000 Subject: refactor: migrate trpc to the new react query integration mode (#2438) * refactor: migrate trpc to the new react query integration mode * more fixes * more migrations * upgrade trpc client --- packages/shared-react/providers/trpc-provider.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'packages/shared-react/providers/trpc-provider.tsx') diff --git a/packages/shared-react/providers/trpc-provider.tsx b/packages/shared-react/providers/trpc-provider.tsx index 696bf195..2c41aa11 100644 --- a/packages/shared-react/providers/trpc-provider.tsx +++ b/packages/shared-react/providers/trpc-provider.tsx @@ -1,9 +1,11 @@ import { useMemo } from "react"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { httpBatchLink } from "@trpc/client"; +import { createTRPCClient, httpBatchLink } from "@trpc/client"; import superjson from "superjson"; -import { api } from "../trpc"; +import type { AppRouter } from "@karakeep/trpc/routers/_app"; + +import { TRPCProvider } from "../trpc"; interface Settings { apiKey?: string; @@ -12,7 +14,7 @@ interface Settings { } function getTRPCClient(settings: Settings) { - return api.createClient({ + return createTRPCClient({ links: [ httpBatchLink({ url: `${settings.address}/api/trpc`, @@ -31,7 +33,7 @@ function getTRPCClient(settings: Settings) { }); } -export function TRPCProvider({ +export function TRPCSettingsProvider({ settings, children, }: { @@ -42,8 +44,10 @@ export function TRPCProvider({ const trpcClient = useMemo(() => getTRPCClient(settings), [settings]); return ( - - {children} - + + + {children} + + ); } -- cgit v1.2.3-70-g09d2