From b5c930ed6895c9477e41b7cb10629b37109ff812 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Tue, 11 Oct 2022 06:44:29 +0800 Subject: [PATCH] [portal] disable react query refetch on window focus --- apps/portal/src/pages/_app.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/portal/src/pages/_app.tsx b/apps/portal/src/pages/_app.tsx index 5de4ac99..11606124 100644 --- a/apps/portal/src/pages/_app.tsx +++ b/apps/portal/src/pages/_app.tsx @@ -53,13 +53,18 @@ export default withTRPC({ }), httpBatchLink({ url }), ], - transformer: superjson, - url, /** - * @link https://react-query.tanstack.com/reference/QueryClient + * @link https://tanstack.com/query/v4/docs/reference/QueryClient */ - // queryClientConfig: { defaultOptions: { queries: { staleTime: 60 } } }, - + queryClientConfig: { + defaultOptions: { + queries: { + refetchOnWindowFocus: false, + }, + }, + }, + transformer: superjson, + url, // To use SSR properly you need to forward the client's headers to the server // headers: () => { // if (ctx?.req) {