Optimised react-query caching to prevent excessive requests (#17595)

refs https://github.com/TryGhost/Product/issues/3349
This commit is contained in:
Jono M 2023-08-04 12:24:19 +01:00 committed by GitHub
parent 77cc6df64a
commit cf947bc4d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,15 @@ interface AppProps {
officialThemes: OfficialTheme[];
}
const queryClient = new QueryClient();
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
staleTime: 5 * (60 * 1000), // 5 mins
cacheTime: 10 * (60 * 1000) // 10 mins
}
}
});
function App({ghostVersion, officialThemes}: AppProps) {
return (