Skip to content

Commit

Permalink
fix: workflow boolean inputs default value
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Nov 11, 2024
1 parent 85f88e1 commit 9514a7d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/manager/RunSetupInputForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,19 @@ const RunSetupInputForm = ({ initialValues, onSubmit, workflow, onBack, onChange
.filter((i) => !i.hidden && !i.injected)
.map((i) => {
const [component, options] = getInputComponentAndOptions(i);

// Default to setting initialValue for boolean inputs to "false"
// so that the value is set when the form item is not interacted with
let initialValue = initialValues[i.id];
if (!initialValue && i.type === "boolean") {
initialValue = false;
}
return (
<Form.Item
key={i.id}
label={i.id}
name={i.id}
initialValue={initialValues[i.id]}
initialValue={initialValue}
rules={
// Default to requiring the field unless the "required" property is set on the input
// or the input is a boolean (i.e., checkbox), since booleans will always be present.
Expand Down

0 comments on commit 9514a7d

Please sign in to comment.