Download src/lib/queryClient.ts from Jessedbrown/daisy-client: direct link, hf CLI and curl.
- Browser
- Download file 952 Bytes
-
https://huggingface.co/Jessedbrown/daisy-client/resolve/main/src/lib/queryClient.ts
- Command line
-
hf download hf://Jessedbrown/daisy-client/src/lib/queryClient.ts
-
curl -L -o queryClient.ts https://huggingface.co/Jessedbrown/daisy-client/resolve/main/src/lib/queryClient.ts
952 Bytes
| import { QueryClient } from '@tanstack/react-query'; | |
| import { CACHE_CONFIG } from './config'; | |
| import { shouldRetry } from './errors'; | |
| export const queryClient = new QueryClient({ | |
| defaultOptions: { | |
| queries: { | |
| // Time in milliseconds that unused/inactive cache data remains in memory | |
| gcTime: CACHE_CONFIG.GC_TIME, | |
| // Time in milliseconds after data is considered stale | |
| staleTime: CACHE_CONFIG.STALE_TIME, | |
| // Retry failed requests using centralized logic | |
| retry: (failureCount, error: unknown) => shouldRetry(error, failureCount), | |
| // Refetch on window focus | |
| refetchOnWindowFocus: false, | |
| // Refetch on reconnect | |
| refetchOnReconnect: true, | |
| }, | |
| mutations: { | |
| // Retry failed mutations using centralized logic | |
| retry: (failureCount, error: unknown) => | |
| shouldRetry(error, failureCount) && | |
| failureCount < CACHE_CONFIG.RETRY.MAX_MUTATION_RETRIES, | |
| }, | |
| }, | |
| }); | |