Skip to content

Commit

Permalink
⚡️(frontend) add stale cache
Browse files Browse the repository at this point in the history
We add a stale cache to reduce the number of requests to
the server.
This will help to improve the performance of the application.
  • Loading branch information
AntoLC committed Feb 19, 2024
1 parent 68df09e commit 7e49a25
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/frontend/apps/desk/src/pages/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7e49a25

Please sign in to comment.