TRPC QueryClient access in ct3a?

I want to disable windows focus refetching globally like here: https://tanstack.com/query/v4/docs/guides/window-focus-refetching How do I access the queryclient in the scaffolded trpc in ct3a?
Window Focus Refetching | TanStack Query Docs
If a user leaves your application and returns to stale data, React Query automatically requests fresh data for you in the background. You can disable this globally or per-query using the refetchOnWindowFocus option: Disabling Globally
3 Replies
Neto
Neto2y ago
GitHub
create-t3-turbo/trpc.ts at main · t3-oss/create-t3-turbo
Clean and simple starter repo using the T3 Stack along with Expo React Native - create-t3-turbo/trpc.ts at main · t3-oss/create-t3-turbo
Neto
Neto2y ago
Usage with Next.js | tRPC
If you're using tRPC in a new project, consider using one of the example projects as a starting point or for reference: tRPC Example Projects
cyremur
cyremurOP2y ago
thanks, that made it click... put it together now and added the three lines for queryClientConfig
export const trpc = createTRPCNext<AppRouter>({
config() {
return {
queryClientConfig: {
defaultOptions: { queries: { refetchOnWindowFocus: false } },
},
transformer: superjson,
links: [
loggerLink({
enabled: (opts) =>
process.env.NODE_ENV === "development" ||
(opts.direction === "down" && opts.result instanceof Error),
}),
httpBatchLink({
url: `${getBaseUrl()}/api/trpc`,
}),
],
};
},
ssr: false,
});
export const trpc = createTRPCNext<AppRouter>({
config() {
return {
queryClientConfig: {
defaultOptions: { queries: { refetchOnWindowFocus: false } },
},
transformer: superjson,
links: [
loggerLink({
enabled: (opts) =>
process.env.NODE_ENV === "development" ||
(opts.direction === "down" && opts.result instanceof Error),
}),
httpBatchLink({
url: `${getBaseUrl()}/api/trpc`,
}),
],
};
},
ssr: false,
});
Want results from more Discord servers?
Add your server