From cd9e573ea975409c99db6d2d7931c76bc99d291b Mon Sep 17 00:00:00 2001 From: Wonsuk Choi Date: Sun, 18 Oct 2026 22:27:27 +0900 Subject: [PATCH] fix(examples/react/nextjs): set a default 'staleTime' so the statically generated posts are not refetched right after hydration (#12077) --- examples/react/nextjs/src/pages/_app.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/react/nextjs/src/pages/_app.tsx b/examples/react/nextjs/src/pages/_app.tsx index a62c582869..0fd6768720 100644 --- a/examples/react/nextjs/src/pages/_app.tsx +++ b/examples/react/nextjs/src/pages/_app.tsx @@ -8,7 +8,16 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools' import type { AppProps } from 'next/app' export default function MyApp({ Component, pageProps }: AppProps) { - const [queryClient] = React.useState(() => new QueryClient()) + const [queryClient] = React.useState( + () => + new QueryClient({ + defaultOptions: { + queries: { + staleTime: 60 * 1000, + }, + }, + }), + ) return (