From e67c98b48536ef579efb83d8f072a1cd2c91f0d4 Mon Sep 17 00:00:00 2001 From: Michael DeGiovanni Date: Mon, 6 May 2024 09:22:02 +0200 Subject: [PATCH] fix: AutoFromFieldObject not utilising base schema (#526) --- .../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 98d1a5f5d..ea748d460 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 e38ca8c95..5d442ba80 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)