Skip to content

Commit e67c98b

Browse files
authored
fix: AutoFromFieldObject not utilising base schema (#526)
1 parent 9dfb0b8 commit e67c98b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

apps/www/src/lib/registry/default/ui/auto-form/AutoFormFieldObject.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ const shapes = computed(() => {
2828
return
2929
Object.keys(shape).forEach((name) => {
3030
const item = shape[name] as ZodAny
31-
let options = 'values' in item._def ? item._def.values as string[] : undefined
31+
const baseItem = getBaseSchema(item) as ZodAny
32+
let options = (baseItem && 'values' in baseItem._def) ? baseItem._def.values as string[] : undefined
3233
if (!Array.isArray(options) && typeof options === 'object')
3334
options = Object.values(options)
3435

apps/www/src/lib/registry/new-york/ui/auto-form/AutoFormFieldObject.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ const shapes = computed(() => {
2828
return
2929
Object.keys(shape).forEach((name) => {
3030
const item = shape[name] as ZodAny
31-
let options = 'values' in item._def ? item._def.values as string[] : undefined
31+
const baseItem = getBaseSchema(item) as ZodAny
32+
let options = (baseItem && 'values' in baseItem._def) ? baseItem._def.values as string[] : undefined
3233
if (!Array.isArray(options) && typeof options === 'object')
3334
options = Object.values(options)
3435

0 commit comments

Comments
 (0)