⚡️(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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user