Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/fix-checkbox-group-required.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bigcommerce/catalyst-core": patch
---

Fix `formField.required` mismatch for `checkbox-group` fields in `DynamicForm`. The schema branch was missing `.optional()` for non-required checkbox groups.

5 changes: 2 additions & 3 deletions core/vibes/soul/form/dynamic-form/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,8 @@ function getFieldSchema(
break;

case 'checkbox-group':
fieldSchema = z.string().array();

if (field.required === true) fieldSchema = fieldSchema.nonempty();
fieldSchema =
field.required === true ? z.string().array().nonempty() : z.string().array().optional();
Comment thread
chanceaclark marked this conversation as resolved.
Outdated

break;

Expand Down
Loading