From 2ceb3c68aa0608cccf7890ce810686a50ac65539 Mon Sep 17 00:00:00 2001 From: utnim2 <mintugogoi567@gmail.com> Date: Sat, 13 Apr 2024 02:00:11 +0530 Subject: [PATCH] fix for adding property type to `array<object>` --- .../ui/components/VisualEditor/PropertyControls.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/ui/components/VisualEditor/PropertyControls.tsx b/packages/ui/components/VisualEditor/PropertyControls.tsx index d8b6d8e18..3d6767eb4 100644 --- a/packages/ui/components/VisualEditor/PropertyControls.tsx +++ b/packages/ui/components/VisualEditor/PropertyControls.tsx @@ -31,11 +31,18 @@ const PropertyControls: React.FC<PropertyControlsProps> = ({ onAdd, schemaPath, const fullPath = schemaPath ? `${schemaPath}.properties.${key}` : `properties.${key}`; console.log('Full Full Path :)', fullPath); console.log(`Adding new property at: ${fullPath}`); - + onAdd(fullPath, { type, ...(type === 'object' && { properties: {} }), - ...(type === 'array' && { items: { type: itemType } }) + ...(type === 'array' && { + items: (itemType !== 'object') + ? { type: itemType } + : { + type: 'object', + properties: {}, + } + }) } as any); setKey('');