add default stale time to queries
All checks were successful
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m11s

This commit is contained in:
Lee 2024-10-20 14:04:55 +01:00
parent 9d2a26fa07
commit a68e53734d

@ -1,12 +1,19 @@
"use client"; "use client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactNode } from "react";
type Props = { type Props = {
children: React.ReactNode; children: ReactNode;
}; };
const queryClient = new QueryClient(); const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 30, // 30 seconds
},
},
});
export function QueryProvider({ children }: Props) { export function QueryProvider({ children }: Props) {
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>; return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;