From db5848ea2b2e047bab9e3afad941d1be050369c9 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Tue, 11 Jul 2023 14:30:56 -0300 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A7=20fix(parameterComponent):=20r?= =?UTF-8?q?emove=20console.log=20statement=20for=20refNumberComponents=20v?= =?UTF-8?q?ariable=20=F0=9F=94=A7=20fix(EditNodeModal):=20change=20filter?= =?UTF-8?q?=20method=20to=20map=20method=20in=20changeAdvanced=20function?= =?UTF-8?q?=20to=20correctly=20update=20advanced=20property=20of=20templat?= =?UTF-8?q?e=20object?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GenericNode/components/parameterComponent/index.tsx | 1 - src/frontend/src/modals/EditNodeModal/index.tsx | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index aadc0c6e6..2c94aa205 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -98,7 +98,6 @@ export default function ParameterComponent({ const groupedObj = groupByFamily(myData, tooltipTitle, left, data.type); refNumberComponents.current = groupedObj[0]?.type?.length; - console.log(refNumberComponents); refHtml.current = groupedObj.map((item, i) => { const Icon: any = nodeIconsLucide[item.family]; diff --git a/src/frontend/src/modals/EditNodeModal/index.tsx b/src/frontend/src/modals/EditNodeModal/index.tsx index a343bc09b..25e76eaa2 100644 --- a/src/frontend/src/modals/EditNodeModal/index.tsx +++ b/src/frontend/src/modals/EditNodeModal/index.tsx @@ -72,15 +72,16 @@ export default function EditNodeModal({ data }: { data: NodeDataType }) { } } - function changeAdvanced(node): void { - Object.keys(data.node.template).filter((n, i) => { + function changeAdvanced(node) { + Object.keys(data.node.template).map((n, i) => { if (n === node.name) { data.node.template[n].advanced = !data.node.template[n].advanced; } - return true; + return n; }); setNodeValue(!nodeValue); } + const handleOnNewValue = (newValue: any, name) => { data.node.template[name].value = newValue; From 63e8e927e7505865e230ade427d226f44d9433bc Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 11 Jul 2023 15:29:48 -0300 Subject: [PATCH 2/2] fix(parameterComponent): add null check before calling cleanEdges to prevent error when reactFlowInstance is null --- .../components/parameterComponent/index.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 2c94aa205..a3e3e6357 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -311,13 +311,15 @@ export default function ParameterComponent({ field_name={name} setNodeClass={(nodeClass) => { data.node = nodeClass; - cleanEdges({ - flow: { - edges: reactFlowInstance.getEdges(), - nodes: reactFlowInstance.getNodes(), - }, - updateEdge: (edge) => reactFlowInstance.setEdges(edge), - }); + if (reactFlowInstance) { + cleanEdges({ + flow: { + edges: reactFlowInstance.getEdges(), + nodes: reactFlowInstance.getNodes(), + }, + updateEdge: (edge) => reactFlowInstance.setEdges(edge), + }); + } }} nodeClass={data.node} disabled={disabled}