17 lines
544 B
TypeScript
17 lines
544 B
TypeScript
import { QueryClient } from "@tanstack/react-query";
|
|
|
|
// Server state lives here. Pages read through useQuery and never cache
|
|
// responses in useState.
|
|
export const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
// Status data goes stale fast, but a focus storm on every alt-tab is
|
|
// worse: pages that need live data poll or refetch explicitly.
|
|
staleTime: 10_000,
|
|
refetchOnWindowFocus: false,
|
|
// Fail fast to the page's error state; the operator retries there.
|
|
retry: 1,
|
|
},
|
|
},
|
|
});
|