feat: add query provider for Tanstack

This commit is contained in:
Ilia Mashkov
2026-01-13 19:49:51 +03:00
parent 6e8376b8fc
commit 0f1eb489ed
2 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { QueryClient } from '@tanstack/query-core';
/**
* Query client instance
*/
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
/**
* Default staleTime: 5 minutes
*/
staleTime: 5 * 60 * 1000,
/**
* Default gcTime: 10 minutes
*/
gcTime: 10 * 60 * 1000,
refetchOnWindowFocus: false,
refetchOnMount: true,
retry: 3,
/**
* Exponential backoff
*/
retryDelay: attemptIndex => Math.min(1000 * 2 ** attemptIndex, 30000),
},
},
});