Fix composite state with label

This commit is contained in:
Ashish Jain 2024-06-26 14:51:19 +02:00
parent fc78ee0fc5
commit a46f993e3e
2 changed files with 13 additions and 1 deletions

View File

@ -301,8 +301,13 @@ export const dataFetcher = (
// If there's only 1 description entry, just use a regular state shape
if (newNode.description?.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {
if (newNode.type === 'group') {
newNode.shape = SHAPE_GROUP;
} else {
newNode.shape = SHAPE_STATE;
}
//newNode.shape = SHAPE_STATE;
}
// group
if (!newNode.type && parsedItem.doc) {

View File

@ -225,6 +225,13 @@ const extract = (_doc) => {
if (Array.isArray(node.label)) {
// add the rest as description
node.description = node.label.slice(1);
if (node.isGroup && node.description.length > 0) {
throw new Error(
'Group nodes can only have label. Remove the additional description for node [' +
node.id +
']'
);
}
// add first description as label
node.label = node.label[0];
}