From a7d14e0e43179a42e4e07c260991d0dc8795069d Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 2 Mar 2026 22:37:58 +0000 Subject: [PATCH] add global swr config --- client/src/App.tsx | 59 ++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 127426c85..15c94dbb5 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -4,39 +4,52 @@ import "react-toastify/dist/ReactToastify.css"; import { ToastContainer } from "react-toastify"; import { ThemeProvider } from "@emotion/react"; import { CssBaseline, GlobalStyles } from "@mui/material"; +import { SWRConfig } from "swr"; import { Routes } from "./Routes"; import AppLayout from "@/Components/layout/AppLayout"; import type { RootState } from "@/Types/state"; import { lightTheme, darkTheme } from "@/Utils/Theme/Theme"; +const swrConfig = { + dedupingInterval: 5000, + revalidateOnFocus: false, + revalidateOnReconnect: true, + shouldRetryOnError: false, + errorRetryCount: 2, + errorRetryInterval: 1000, + focusThrottleInterval: 5000, +}; + function App() { const mode = useSelector((state: RootState) => state.ui.mode); const theme = mode === "light" ? lightTheme : darkTheme; return ( - - - - - - - - + + + + + + + + + + ); }