Skip to content

Commit

Permalink
fix(test): try to fix test on other app
Browse files Browse the repository at this point in the history
  • Loading branch information
fffjacquier committed Jun 20, 2024
1 parent 8251d7d commit fc0275b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions libs/form-builder/src/lib/formBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ export function FormBuilder({
rules={validationRulesById[fieldId]}
render={({ field }) => {
const { ref, onChange, ...fieldRest } = field;

const handleOnChangeFromField = (event: unknown) => {
onChange(event);
trigger(id);
};
const onChangeAttr =
behavior === 'onChangeTriggerByField' ? { onChange: handleOnChangeFromField } : null;

return (
<FormField
id={id}
Expand All @@ -164,12 +172,7 @@ export function FormBuilder({
{...formMeta}
{...meta}
{...fieldRest}
onChange={(event) => {
onChange(event);
if (behavior === 'onChangeTriggerByField') {
trigger(id);
}
}}
{...onChangeAttr}
/>
);
}}
Expand Down

0 comments on commit fc0275b

Please sign in to comment.