Ivan Galakhov 4 лет назад
Родитель
Сommit
40d73f6a07

+ 1 - 1
dashboard/src/components/porter-form/field-components/ArrayInput.tsx

@@ -12,7 +12,7 @@ const ArrayInput: React.FC<ArrayInputField> = (props) => {
     props.id,
     {
       initVars: {
-        [props.variable]: props.value ? props.value[0] : [],
+        [props.variable]: props.value && props.value[0] ? props.value[0] : [],
       },
     }
   );

+ 3 - 1
dashboard/src/components/porter-form/field-components/Input.tsx

@@ -36,7 +36,7 @@ const Input: React.FC<InputField> = ({
   } = useFormField<StringInputFieldState>(id, {
     initValidation: {
       validated: value
-        ? value[0] !== undefined && value[0] !== ""
+        ? value[0] !== undefined && value[0] !== "" && value[0] != null
         : settings?.default != undefined,
     },
     initVars: {
@@ -50,6 +50,8 @@ const Input: React.FC<InputField> = ({
     return <></>;
   }
 
+  console.log(value);
+
   const curValue =
     settings?.type == "number"
       ? !isNaN(parseFloat(variables[variable]))