️(frontend) add stale cache

We add a stale cache to reduce the number of requests to
the server.
This will help to improve the performance of the application.
This commit is contained in:
Anthony LC
2024-02-19 12:30:31 +01:00
committed by Anthony LC
parent 8b0c20dbdc
commit cd2efbe40d

View File

@@ -6,7 +6,20 @@ import { useCunninghamTheme } from '@/cunningham';
import { Auth } from '@/features/auth/Auth';
import '@/i18n/initI18n';
const queryClient = new QueryClient();
/**
* QueryClient:
* - defaultOptions:
* - staleTime:
* - global cache duration - we decided 3 minutes
* - It can be overridden to each query
*/
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 60 * 3,
},
},
});
export default function AppProvider({
children,