T
Join ServertRPC
❓-help
trpc auto refreshes page when I lose focus
Hi, i thought this was a development environment only configuration, but it does it even in production. How am I able to change this functionality?
It's a react query setting, can be changed globally in the QueryClient
Worth exploring the docs for that, it's 1 key, but there are several in the same vein
Hi. Thank you 🙂
I have found
https://tanstack.com/query/v4/docs/react/guides/window-focus-refetching
I have found
refetchOnWindowFocus
which is what I am looking for. Here is my fix for any future people.export const api = createTRPCNext<AppRouter>({
config() {
return {
transformer: superjson,
queryClientConfig: {
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
},
},
},
https://tanstack.com/query/v4/docs/react/guides/window-focus-refetching