diff --git a/src/components/Launch/LaunchForm/StructInput.tsx b/src/components/Launch/LaunchForm/StructInput.tsx index fd27c327c..7ef9c91e7 100644 --- a/src/components/Launch/LaunchForm/StructInput.tsx +++ b/src/components/Launch/LaunchForm/StructInput.tsx @@ -53,12 +53,6 @@ export const StructInput: React.FC = props => { const hasError = !!error; const helperText = hasError ? error : props.helperText; - const [paramData, setParamData] = useState({}); - const onFormChange = ({ formData }, e) => { - onChange(JSON.stringify(formData)); - setParamData(formData); - }; - let jsonFormRenderable = false; let parsedJson: PrimitiveType = {}; @@ -81,6 +75,15 @@ export const StructInput: React.FC = props => { } } + const [paramData, setParamData] = useState( + jsonFormRenderable ? JSON.parse(value as string) : {} + ); + + const onFormChange = ({ formData }, e) => { + onChange(JSON.stringify(formData)); + setParamData(formData); + }; + return jsonFormRenderable ? (