diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index 98683f071..9dac530e9 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -19,11 +19,11 @@ export default function CodeAreaComponent({ typeof value == "string" ? value : JSON.stringify(value) ); useEffect(() => { - if (disabled) { + if (disabled && myValue !== "") { setMyValue(""); onChange(""); } - }, [disabled, onChange]); + }, [disabled]); useEffect(() => { setMyValue(typeof value == "string" ? value : JSON.stringify(value)); diff --git a/src/frontend/src/components/floatComponent/index.tsx b/src/frontend/src/components/floatComponent/index.tsx index 005ae1252..9716da83c 100644 --- a/src/frontend/src/components/floatComponent/index.tsx +++ b/src/frontend/src/components/floatComponent/index.tsx @@ -15,10 +15,10 @@ export default function FloatComponent({ const max = rangeSpec?.max ?? 2; // Clear component state useEffect(() => { - if (disabled) { + if (disabled && value !== "") { onChange(""); } - }, [disabled, onChange]); + }, [disabled]); return (
diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index 06d2f0f6a..ae154484d 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -13,7 +13,7 @@ export default function InputListComponent({ editNode = false, }: InputListComponentType): JSX.Element { useEffect(() => { - if (disabled) { + if (disabled && value.length > 0 && value[0] !== "") { onChange([""]); } }, [disabled]); diff --git a/src/frontend/src/components/keypairListComponent/index.tsx b/src/frontend/src/components/keypairListComponent/index.tsx index ec6902c32..82e46d2c7 100644 --- a/src/frontend/src/components/keypairListComponent/index.tsx +++ b/src/frontend/src/components/keypairListComponent/index.tsx @@ -14,7 +14,7 @@ export default function KeypairListComponent({ duplicateKey, }: KeyPairListComponentType): JSX.Element { useEffect(() => { - if (disabled) { + if (disabled && value.length > 0 && value[0] !== "") { onChange([""]); } }, [disabled]); diff --git a/src/frontend/src/components/textAreaComponent/index.tsx b/src/frontend/src/components/textAreaComponent/index.tsx index 08d15ed02..39d57ebf3 100644 --- a/src/frontend/src/components/textAreaComponent/index.tsx +++ b/src/frontend/src/components/textAreaComponent/index.tsx @@ -14,7 +14,7 @@ export default function TextAreaComponent({ }: TextAreaComponentType): JSX.Element { // Clear text area useEffect(() => { - if (disabled) { + if (disabled && value !== "") { onChange(""); } }, [disabled]);