Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions electron-app/src/ipc/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
getCurrentView,
getMainWindow,
loadView,
reloadWindow,
} from "../windows/mainWindow.js";

/**
Expand All @@ -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");
}
});

Expand Down
6 changes: 5 additions & 1 deletion frontend/testing-view/src/components/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
Expand Down
Loading