From 4a03e81314842d08b0d54fdb1b57ae1da5d0ad4e Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Fri, 15 Sep 2023 16:07:08 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(parameterComponent):=20remov?= =?UTF-8?q?e=20redundant=20conditional=20statement=20and=20set=20dictionar?= =?UTF-8?q?y=20array=20and=20node=20template=20value=20directly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The conditional statement checking for duplicate keys and setting the dictionary array was redundant. Instead, the dictionary array is now always set to the new value. Additionally, the node template value is now always updated with the new value. --- .../GenericNode/components/parameterComponent/index.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 548c90180..19916002a 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -389,12 +389,8 @@ export default function ParameterComponent({ duplicateKey={errorDuplicateKey} onChange={(newValue) => { setErrorDuplicateKey(hasDuplicateKeys(newValue)); - if (hasDuplicateKeys(newValue)) { - setDictArr(newValue); - } else { - setDictArr(newValue); - data.node!.template[name].value = newValue; - } + setDictArr(newValue); + data.node!.template[name].value = newValue; }} />