From 5fd4dff21790ec473a525f851fc23564078f879c Mon Sep 17 00:00:00 2001 From: mahdiall99 Date: Wed, 20 Nov 2024 12:50:36 -0500 Subject: [PATCH] Added new condition to avoid false error message on start --- renderer/components/layout/layoutManager.jsx | 30 +++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/renderer/components/layout/layoutManager.jsx b/renderer/components/layout/layoutManager.jsx index 9788cf47..153bc73c 100644 --- a/renderer/components/layout/layoutManager.jsx +++ b/renderer/components/layout/layoutManager.jsx @@ -25,6 +25,7 @@ import { WorkspaceContext } from "../workspace/workspaceContext" import { requestBackend } from "../../utilities/requests" import { toast } from "react-toastify" import NotificationOverlay from "../generalPurpose/notificationOverlay" +import { getBundledPythonEnvironment } from "../../../main/utils/pythonEnv" import os from "os" @@ -48,19 +49,22 @@ const LayoutManager = (props) => { useEffect(() => { console.log("port set to: ", port) if (port) { - requestBackend( - port, - "clearAll", - { data: "clearAll" }, - (data) => { - console.log("clearAll received data:", data) - toast.success("Go server is connected and ready !") - }, - (error) => { - console.log("clearAll error:", error) - toast.error("Go server is not connected !") - } - ) + let bundledPythonPath = getBundledPythonEnvironment() + if (bundledPythonPath !== null) { + requestBackend( + port, + "clearAll", + { data: "clearAll" }, + (data) => { + console.log("clearAll received data:", data) + toast.success("Go server is connected and ready !") + }, + (error) => { + console.log("clearAll error:", error) + toast.error("Go server is not connected !") + } + ) + } } }, [port])