From 4f04698a602cbca8a328563c59c217f9034b2e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Thu, 13 Mar 2025 22:24:02 -0300 Subject: [PATCH] perf: add staleTime to queryClient to avoid excessive calls (#1740) --- src/index.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.jsx b/src/index.jsx index 34f27f1b9..c885dac16 100755 --- a/src/index.jsx +++ b/src/index.jsx @@ -35,7 +35,13 @@ import { ToastProvider } from './generic/toast-context'; import 'react-datepicker/dist/react-datepicker.css'; import './index.scss'; -const queryClient = new QueryClient(); +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 60 * 60_000, // If cache is up to one hour old, no need to re-fetch + }, + }, +}); const App = () => { useEffect(() => {