diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index b95631c107..570db8c1da 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -3,6 +3,7 @@ import 'styles.scss'; import * as Sentry from '@sentry/react'; import AppRoutes from 'AppRoutes'; +import { AxiosError } from 'axios'; import { ThemeProvider } from 'hooks/useDarkMode'; import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback'; import { createRoot } from 'react-dom/client'; @@ -16,6 +17,17 @@ const queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false, + retry(failureCount, error): boolean { + if ( + // in case of manually throwing errors please make sure to send error.response.status + error instanceof AxiosError && + error.response?.status && + (error.response?.status >= 400 || error.response?.status <= 499) + ) { + return false; + } + return failureCount < 2; + }, }, }, });