From a68e53734d63b680bc1427cd7658825dcf3ddb9c Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 20 Oct 2024 14:04:55 +0100 Subject: [PATCH] add default stale time to queries --- .../src/components/providers/query-provider.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/projects/website/src/components/providers/query-provider.tsx b/projects/website/src/components/providers/query-provider.tsx index c19f40e..5939a64 100644 --- a/projects/website/src/components/providers/query-provider.tsx +++ b/projects/website/src/components/providers/query-provider.tsx @@ -1,12 +1,19 @@ "use client"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { ReactNode } from "react"; 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) { return {children};