Skip to content

Commit

Permalink
fix: account for expandable checklists in editor modal passport value…
Browse files Browse the repository at this point in the history
… validation (#4045)
  • Loading branch information
jessicamcinchak authored Dec 5, 2024
1 parent 8b284ed commit 05a7c62
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ export const ChecklistComponent: React.FC<ChecklistProps> = (props) => {
alert(JSON.stringify({ type, ...values, options }, null, 2));
}
},
validate: ({ options, ...values }) => {
validate: ({ options, groupedOptions, ...values }) => {
const errors: FormikErrors<FormikValues> = {};
// Account for flat or expandable Checklist options
options =
options || groupedOptions?.map((group) => group.children)?.flat();
if (values.fn && !options?.some((option) => option.data.val)) {
errors.fn =
"At least one option must set a data value when the checklist has a data field";
Expand Down

0 comments on commit 05a7c62

Please sign in to comment.