Skip to content

Commit

Permalink
Remove console logs from DynamicForm component and streamline option …
Browse files Browse the repository at this point in the history
…filtering logic
  • Loading branch information
van-go committed Feb 25, 2025
1 parent e1f16cd commit 2715e3d
Showing 1 changed file with 0 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,18 @@ const DynamicForm = ({ initialFormFields, onChange }) => {
modifiedField
) => {
const { dependency } = field;
console.log(field.options)
const filteredOptions = field.options.filter(option => {
if (option.value === 'other') {
return true;
}
return option.dependentId === values[dependency.name];
});
console.log(filteredOptions)
const updatedOptions = [{ value: '', label: '' }, ...filteredOptions];

// Only update the field value if the modified field is the dependency field
if (modifiedField && modifiedField.name === dependency.name) {
setFieldValue(field.name, updatedOptions[0].value);
}
console.log(updatedOptions)
return {
...field,
hidden: false,
Expand Down

0 comments on commit 2715e3d

Please sign in to comment.