From db17545aa54fe60f04088d6564aa4de7862506eb Mon Sep 17 00:00:00 2001 From: Javier Ribal del Rio Date: Sat, 27 Jun 2026 11:46:40 +0200 Subject: [PATCH] fix(testing-view):reload button --- electron-app/src/ipc/handlers.js | 4 ++-- frontend/testing-view/src/components/Error.tsx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/electron-app/src/ipc/handlers.js b/electron-app/src/ipc/handlers.js index 973623e18..177e9383e 100644 --- a/electron-app/src/ipc/handlers.js +++ b/electron-app/src/ipc/handlers.js @@ -26,7 +26,6 @@ import { getCurrentView, getMainWindow, loadView, - reloadWindow, } from "../windows/mainWindow.js"; /** @@ -53,10 +52,11 @@ function setupIpcHandlers() { ipcMain.handle("restart-backend", async () => { try { await restartBackend(); - reloadWindow(); } catch (error) { logger.electron.error("Failed to restart backend:", error); dialog.showErrorBox("Restart Failed", `Could not restart backend:\n\n${error.message}`); + } finally { + loadView("testing-view"); } }); diff --git a/frontend/testing-view/src/components/Error.tsx b/frontend/testing-view/src/components/Error.tsx index 645015c39..bb800471d 100644 --- a/frontend/testing-view/src/components/Error.tsx +++ b/frontend/testing-view/src/components/Error.tsx @@ -21,6 +21,7 @@ interface ErrorProps { */ export const Error = ({ error: propError, componentStack }: ErrorProps) => { const storeError = useStore((s) => s.error); + const setRestarting = useStore((s) => s.setRestarting); const error = propError || storeError; const [showDetails, setShowDetails] = useState(false); const [countdown, setCountdown] = useState(RELOAD_COOLDOWN); @@ -34,7 +35,10 @@ export const Error = ({ error: propError, componentStack }: ErrorProps) => { const handleReload = () => { setCountdown(RELOAD_COOLDOWN); if (window.electronAPI) { - window.electronAPI.restartBackend(); + setRestarting(true); + window.electronAPI.restartBackend().catch(() => { + setRestarting(false); + }); } else { window.location.reload(); }