Skip to content

Commit

Permalink
FIX select input issue
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinovega committed Jan 24, 2022
1 parent 1c308d5 commit 14a0ec6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ export const Form = React.forwardRef(({ schema, flow, value, inputWrapper, onSub
switch (typeof visible) {
case 'object':
const value = watch(step.visible.ref);
console.log({ value, step })
return option(step.visible.test).map(test => test(value)).getOrElse(value)
case 'boolean':
return visible;
Expand Down Expand Up @@ -303,7 +302,7 @@ const Step = ({ entry, step, error, errors, register, schema, control, trigger,
<BasicWrapper key={`collapse-${en}-${entryIdx}`} entry={en} error={err} label={stp?.label || en} help={stp?.help} render={inputWrapper}>
<Step entry={en} step={stp} error={err} errors={errors}
register={register} schema={schema} control={control} trigger={trigger} getValues={getValues}
setValue={setValue} watch={watch} inputWrapper={inputWrapper} />
setValue={setValue} watch={watch} inputWrapper={inputWrapper} httpClient={httpClient} defaultValue={stp.defaultValue}/>
</BasicWrapper>
)
})}
Expand Down
4 changes: 2 additions & 2 deletions src/inputs/SelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const valueToSelectOption = (value, possibleValues = [], isMulti = false, maybeT
const maybeValue = option(possibleValues.find(v => deepEqual(v.value, value)))
return maybeValue
.getOrElse({
label: maybeValue.map(v => v.label).getOrElse(value),
value: maybeValue.map(v => v.value).getOrElse(value),
label: maybeValue.map(v => v.label).getOrElse(value?.label || value),
value: maybeValue.map(v => v.value).getOrElse(value?.value || value),
});
};

Expand Down

0 comments on commit 14a0ec6

Please sign in to comment.