mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-11 06:00:15 -07:00
25 lines
635 B
TypeScript
25 lines
635 B
TypeScript
import { QueryClient } from '@tanstack/react-query';
|
|
|
|
|
|
let queryClient: QueryClient | null = null;
|
|
|
|
export function reactQueryClientSingleton(): QueryClient {
|
|
if (!queryClient) {
|
|
queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
retry: false,
|
|
// call functions even when the network is disconnected; this makes 127.0.0.1 work, while probably not causing other issues
|
|
networkMode: 'always',
|
|
refetchOnWindowFocus: false,
|
|
},
|
|
mutations: {
|
|
retry: false,
|
|
networkMode: 'always',
|
|
},
|
|
},
|
|
});
|
|
}
|
|
return queryClient;
|
|
}
|