diff --git a/src/frontend/src/components/keypairListComponent/index.tsx b/src/frontend/src/components/keypairListComponent/index.tsx index b92a8faa5..360ebb37e 100644 --- a/src/frontend/src/components/keypairListComponent/index.tsx +++ b/src/frontend/src/components/keypairListComponent/index.tsx @@ -13,6 +13,7 @@ export default function KeypairListComponent({ editNode = false, duplicateKey, advanced = false, + dataValue, }: KeyPairListComponentType): JSX.Element { useEffect(() => { if (disabled) { @@ -30,18 +31,16 @@ export default function KeypairListComponent({ }, [value]); const handleChangeKey = (event, idx) => { - const newInputList = _.cloneDeep(ref.current); - const oldKey = Object.keys(newInputList[idx])[0]; - const updatedObj = { [event.target.value]: newInputList[idx][oldKey] }; - newInputList[idx] = updatedObj; - onChange(newInputList); + const oldKey = Object.keys(ref.current[idx])[0]; + const updatedObj = { [event.target.value]: ref.current[idx][oldKey] }; + ref.current[idx] = updatedObj; + onChange(ref.current); }; const handleChangeValue = (newValue, idx) => { - const newInputList = _.cloneDeep(ref.current); - const key = Object.keys(newInputList[idx])[0]; - newInputList[idx][key] = newValue; - onChange(newInputList); + const key = Object.keys(ref.current[idx])[0]; + ref.current[idx][key] = newValue; + onChange(ref.current); }; return ( diff --git a/src/frontend/src/modals/EditNodeModal/index.tsx b/src/frontend/src/modals/EditNodeModal/index.tsx index aba6f2db4..768c70daa 100644 --- a/src/frontend/src/modals/EditNodeModal/index.tsx +++ b/src/frontend/src/modals/EditNodeModal/index.tsx @@ -81,6 +81,7 @@ const EditNodeModal = forwardRef( const handleOnNewValue = (newValue: any, name) => { myData.current.node!.template[name].value = newValue; + setDataValue(newValue); }; useEffect(() => { @@ -90,6 +91,7 @@ const EditNodeModal = forwardRef( const [errorDuplicateKey, setErrorDuplicateKey] = useState(false); const [adv, setAdv] = useState(null); + const [dataValue, setDataValue] = useState(data); return (