File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
core/vibes/soul/form/dynamic-form Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @bigcommerce/catalyst-core " : patch
3+ ---
4+
5+ Add missing check for optional text field in ` core/vibes/soul/form/dynamic-form/schema.ts ` .
6+
7+ ## Migration
8+
9+ Add ` if (field.required !== true) fieldSchema = fieldSchema.optional(); ` to ` text ` case in ` core/vibes/soul/form/dynamic-form/schema.ts ` :
10+
11+ ``` typescript
12+ case ' text' :
13+ fieldSchema = z .string ();
14+
15+ if (field .pattern != null ) {
16+ fieldSchema = fieldSchema .regex (new RegExp (field .pattern ), {
17+ message: ' Invalid format.' ,
18+ });
19+ }
20+
21+ if (field .required !== true ) fieldSchema = fieldSchema .optional ();
22+
23+ break ;
24+ ```
Original file line number Diff line number Diff line change @@ -179,6 +179,8 @@ function getFieldSchema(field: Field) {
179179 } ) ;
180180 }
181181
182+ if ( field . required !== true ) fieldSchema = fieldSchema . optional ( ) ;
183+
182184 break ;
183185
184186 case 'password' :
You can’t perform that action at this time.
0 commit comments