From 701571b8588ecd64783827779a0bcff4433bcbcc Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 22 Feb 2024 16:43:43 -0300 Subject: [PATCH] Fix build button condition and prevent sending messages during build --- src/frontend/src/CustomNodes/GenericNode/index.tsx | 2 +- src/frontend/src/components/newChatView/index.tsx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 877a179fc..f95849dd7 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -465,7 +465,7 @@ export default function GenericNode({ variant="outline" className={"h-9 px-1.5"} onClick={() => { - if(data?.build_status === BuildStatus.BUILDING) return; + if(data?.build_status === BuildStatus.BUILDING || isBuilding) return; buildFlow(data.id) }} > diff --git a/src/frontend/src/components/newChatView/index.tsx b/src/frontend/src/components/newChatView/index.tsx index 2831a5c9c..bcb167714 100644 --- a/src/frontend/src/components/newChatView/index.tsx +++ b/src/frontend/src/components/newChatView/index.tsx @@ -35,6 +35,7 @@ export default function newChatView(): JSX.Element { const setIsBuilding = useFlowStore((state) => state.setIsBuilding); const [lockChat, setLockChat] = useState(false); const messagesRef = useRef(null); + const isBuilding = useFlowStore((state) => state.isBuilding); const inputTypes = inputs.map((obj) => obj.type); const inputIds = inputs.map((obj) => obj.id); @@ -105,6 +106,7 @@ export default function newChatView(): JSX.Element { }, []); async function sendMessage(count = 1): Promise { + if(isBuilding) return; const { nodes, edges } = getFlow(); let nodeValidationErrors = validateNodes(nodes, edges); if (nodeValidationErrors.length === 0) {