Skip to content

Commit

Permalink
fix for adding property type to array<object>
Browse files Browse the repository at this point in the history
  • Loading branch information
Gmin2 committed Apr 12, 2024
1 parent d81d930 commit 2ceb3c6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/ui/components/VisualEditor/PropertyControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand Down

0 comments on commit 2ceb3c6

Please sign in to comment.