From f96d9bf8c094284258d8a06aa200fdae4f8811ab Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Wed, 29 Nov 2023 17:36:51 +0000 Subject: [PATCH 1/2] chore(site): enable FE cache --- site/src/App.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/site/src/App.tsx b/site/src/App.tsx index de3fe2a5bd1c4..1791b07778517 100644 --- a/site/src/App.tsx +++ b/site/src/App.tsx @@ -15,13 +15,15 @@ import { } from "@mui/material/styles"; import { ThemeProvider as EmotionThemeProvider } from "@emotion/react"; +const shouldEnableCache = window.location.hostname.includes("dev.coder.com"); + const defaultQueryClient = new QueryClient({ defaultOptions: { queries: { retry: false, - cacheTime: 0, refetchOnWindowFocus: false, - networkMode: "offlineFirst", + cacheTime: shouldEnableCache ? undefined : 0, + networkMode: shouldEnableCache ? undefined : "offlineFirst", }, }, }); From f1d9581c53453fdc75a778e5296e52460b059496 Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Wed, 29 Nov 2023 17:47:29 +0000 Subject: [PATCH 2/2] chore(site): enable react-query cache --- site/src/App.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/src/App.tsx b/site/src/App.tsx index 1791b07778517..da700660d77ed 100644 --- a/site/src/App.tsx +++ b/site/src/App.tsx @@ -15,7 +15,9 @@ import { } from "@mui/material/styles"; import { ThemeProvider as EmotionThemeProvider } from "@emotion/react"; -const shouldEnableCache = window.location.hostname.includes("dev.coder.com"); +const shouldEnableCache = + window.location.hostname.includes("dev.coder.com") || + process.env.NODE_ENV === "development"; const defaultQueryClient = new QueryClient({ defaultOptions: {