Skip to content

Commit

Permalink
Fix: when extra field is of type boolean make sure it's different fro…
Browse files Browse the repository at this point in the history
…m default value to decide if it's open.
  • Loading branch information
arikfr committed Jan 23, 2020
1 parent bd36441 commit b312744
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/app/components/dynamic-form/DynamicForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ class DynamicForm extends React.Component {
super(props);

const hasFilledExtraField = some(props.fields, field => {
const { extra, initialValue } = field;
return extra && (!isEmpty(initialValue) || isNumber(initialValue) || (isBoolean(initialValue) && initialValue));
const { extra, initialValue, placeholder } = field;
return (
extra &&
(!isEmpty(initialValue) ||
isNumber(initialValue) ||
(isBoolean(initialValue) && initialValue.toString() !== placeholder))
);
});

const inProgressActions = {};
Expand Down

0 comments on commit b312744

Please sign in to comment.