Skip to content

Commit 2e8ab2a

Browse files
chore(site): enable react-query cache (coder#10943)
1 parent e4d7b0b commit 2e8ab2a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

site/src/App.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ import {
1515
} from "@mui/material/styles";
1616
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
1717

18+
const shouldEnableCache =
19+
window.location.hostname.includes("dev.coder.com") ||
20+
process.env.NODE_ENV === "development";
21+
1822
const defaultQueryClient = new QueryClient({
1923
defaultOptions: {
2024
queries: {
2125
retry: false,
22-
cacheTime: 0,
2326
refetchOnWindowFocus: false,
24-
networkMode: "offlineFirst",
27+
cacheTime: shouldEnableCache ? undefined : 0,
28+
networkMode: shouldEnableCache ? undefined : "offlineFirst",
2529
},
2630
},
2731
});

0 commit comments

Comments
 (0)