diff --git a/packages/uniforms-bridge-zod/src/ZodBridge.ts b/packages/uniforms-bridge-zod/src/ZodBridge.ts index 967aa8a8f..df453e8b6 100644 --- a/packages/uniforms-bridge-zod/src/ZodBridge.ts +++ b/packages/uniforms-bridge-zod/src/ZodBridge.ts @@ -132,7 +132,12 @@ export default class ZodBridge extends Bridge { } getInitialValue(name: string): unknown { - const field = this.getField(name); + let field = this.getField(name); + + if (field instanceof ZodOptional) { + field = field.unwrap(); + } + if (field instanceof ZodArray) { const item = this.getInitialValue(joinName(name, '$')); if (item === undefined) {