From ac77cee6991db0f909f737aa5bca87bbf6519c20 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa <72977554+Cristhianzl@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:06:49 -0300 Subject: [PATCH] bugfix: fix missing condition to open disconnect modal when backend is down (#2993) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 (App.tsx): Fix logic to correctly display error modal when health data is missing or not "ok" 🔧 (use-get-health.ts): Disable retry option in useGetHealthQuery to prevent unnecessary refetching of health data --- src/frontend/src/App.tsx | 1 + .../src/controllers/API/queries/health/use-get-health.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index 6fc41300c..ca3447e97 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -137,6 +137,7 @@ export default function App() { message={FETCH_ERROR_MESSAGE} openModal={ isErrorHealth || + !healthData || (healthData && Object.values(healthData).some((value) => value !== "ok")) } diff --git a/src/frontend/src/controllers/API/queries/health/use-get-health.ts b/src/frontend/src/controllers/API/queries/health/use-get-health.ts index c0250a799..95ec34f9e 100644 --- a/src/frontend/src/controllers/API/queries/health/use-get-health.ts +++ b/src/frontend/src/controllers/API/queries/health/use-get-health.ts @@ -30,6 +30,7 @@ export const useGetHealthQuery: useQueryFunctionType< const queryResult = query(["useGetHealthQuery"], getHealthFn, { placeholderData: keepPreviousData, refetchInterval: 20000, + retry: false, ...options, });