diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index c65f33a2c..c77aa759c 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -88,8 +88,6 @@ export default function ParameterComponent({ const handleOnNewValue = ( newValue: string | string[] | boolean | Object[] ): void => { - console.log(newValue); - let newData = cloneDeep(data); newData.node!.template[name].value = newValue; setData(newData); diff --git a/src/frontend/src/components/keypairListComponent/index.tsx b/src/frontend/src/components/keypairListComponent/index.tsx index a2ef4f26c..f1e93e7fc 100644 --- a/src/frontend/src/components/keypairListComponent/index.tsx +++ b/src/frontend/src/components/keypairListComponent/index.tsx @@ -1,4 +1,4 @@ -import { useEffect } from "react"; +import { useEffect, useRef } from "react"; import { KeyPairListComponentType } from "../../types/components"; import _ from "lodash"; @@ -19,8 +19,17 @@ export default function KeypairListComponent({ } }, [disabled]); + const ref = useRef(value.length === 0 ? [{ "": "" }] : value); + + useEffect(() => { + if (JSON.stringify(value) !== JSON.stringify(ref.current)) { + ref.current = value; + onChange(value); + } + }, [value]); + const handleChangeKey = (event, idx) => { - const newInputList = _.cloneDeep(value); + const newInputList = _.cloneDeep(ref.current); const oldKey = Object.keys(newInputList[idx])[0]; const updatedObj = { [event.target.value]: newInputList[idx][oldKey] }; newInputList[idx] = updatedObj; @@ -28,7 +37,7 @@ export default function KeypairListComponent({ }; const handleChangeValue = (newValue, idx) => { - const newInputList = _.cloneDeep(value); + const newInputList = _.cloneDeep(ref.current); const key = Object.keys(newInputList[idx])[0]; newInputList[idx][key] = newValue; onChange(newInputList); @@ -37,11 +46,11 @@ export default function KeypairListComponent({ return (