From 8f545ef9e93c0223d530b5b87bac931c1e14e896 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 4 Mar 2024 15:19:37 -0300 Subject: [PATCH] Add validationString state and update validationStatus rendering --- .../src/CustomNodes/GenericNode/index.tsx | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 042757832..80e5ad0f7 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -60,6 +60,8 @@ export default function GenericNode({ useState(null); const [handles, setHandles] = useState(0); + const [validationString, setValidationString] = useState(""); + const takeSnapshot = useFlowsManagerStore((state) => state.takeSnapshot); function countHandles(): void { @@ -132,6 +134,18 @@ export default function GenericNode({ } }, [flowPool[data.id], data.id]); + useEffect(() => { + if (validationStatus?.params) { + // if it is not a string turn it into a string + let newValidationString = validationStatus.params; + if (typeof newValidationString !== "string") { + newValidationString = JSON.stringify(validationStatus.params); + } + + setValidationString(newValidationString); + } + }, [validationStatus, validationStatus?.params]); + const showNode = data.showNode ?? true; const nameEditable = true; @@ -516,11 +530,9 @@ export default function GenericNode({ Output
- {validationStatus?.params - .split("\n") - .map((line, index) => ( -
{line}
- ))} + {validationString.split("\n").map((line, index) => ( +
{line}
+ ))}
)