From a655e1473c994274814d7a5530e403cd735f2f4b Mon Sep 17 00:00:00 2001 From: Michael De Giovanni Date: Fri, 3 May 2024 17:03:04 +0200 Subject: [PATCH] fix: autoformfieldovject not utilisng base schema --- .../lib/registry/default/ui/auto-form/AutoFormFieldObject.vue | 3 ++- .../lib/registry/new-york/ui/auto-form/AutoFormFieldObject.vue | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/www/src/lib/registry/default/ui/auto-form/AutoFormFieldObject.vue b/apps/www/src/lib/registry/default/ui/auto-form/AutoFormFieldObject.vue index 98d1a5f5..ea748d46 100644 --- a/apps/www/src/lib/registry/default/ui/auto-form/AutoFormFieldObject.vue +++ b/apps/www/src/lib/registry/default/ui/auto-form/AutoFormFieldObject.vue @@ -28,7 +28,8 @@ const shapes = computed(() => { return Object.keys(shape).forEach((name) => { const item = shape[name] as ZodAny - let options = 'values' in item._def ? item._def.values as string[] : undefined + const baseItem = getBaseSchema(item) as ZodAny + let options = (baseItem && 'values' in baseItem._def) ? baseItem._def.values as string[] : undefined if (!Array.isArray(options) && typeof options === 'object') options = Object.values(options) diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/AutoFormFieldObject.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/AutoFormFieldObject.vue index e38ca8c9..5d442ba8 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/AutoFormFieldObject.vue +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/AutoFormFieldObject.vue @@ -28,7 +28,8 @@ const shapes = computed(() => { return Object.keys(shape).forEach((name) => { const item = shape[name] as ZodAny - let options = 'values' in item._def ? item._def.values as string[] : undefined + const baseItem = getBaseSchema(item) as ZodAny + let options = (baseItem && 'values' in baseItem._def) ? baseItem._def.values as string[] : undefined if (!Array.isArray(options) && typeof options === 'object') options = Object.values(options)