Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/provider/camunda-platform/properties/FormField.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,9 @@ function ConstraintList(props) {
const commands = [];

// (1) ensure validation
if (!validation) {
validation = createElement(
let ensuredValidation = validation;
if (!ensuredValidation) {
ensuredValidation = createElement(
'camunda:Validation',
{ },
businessObject,
Expand All @@ -437,7 +438,7 @@ function ConstraintList(props) {
context: {
element,
moddleElement: formField,
properties: { validation }
properties: { validation: ensuredValidation }
}
});
}
Expand All @@ -446,17 +447,17 @@ function ConstraintList(props) {
const constraint = createElement(
'camunda:Constraint',
{ name: undefined, config: undefined },
validation,
ensuredValidation,
bpmnFactory
);

commands.push({
cmd: 'element.updateModdleProperties',
context: {
element,
moddleElement: validation,
moddleElement: ensuredValidation,
properties: {
constraints: [ ...validation.get('constraints'), constraint ]
constraints: [ ...ensuredValidation.get('constraints'), constraint ]
}
}
});
Expand Down Expand Up @@ -539,8 +540,9 @@ function PropertiesList(props) {
const commands = [];

// (1) ensure properties
if (!properties) {
properties = createElement(
let ensuredProperties = properties;
if (!ensuredProperties) {
ensuredProperties = createElement(
'camunda:Properties',
{ },
businessObject,
Expand All @@ -552,7 +554,7 @@ function PropertiesList(props) {
context: {
element,
moddleElement: formField,
properties: { properties }
properties: { properties: ensuredProperties }
}
});
}
Expand All @@ -561,17 +563,17 @@ function PropertiesList(props) {
const property = createElement(
'camunda:Property',
{ id: undefined, value: undefined },
properties,
ensuredProperties,
bpmnFactory
);

commands.push({
cmd: 'element.updateModdleProperties',
context: {
element,
moddleElement: properties,
moddleElement: ensuredProperties,
properties: {
values: [ ...properties.get('values'), property ]
values: [ ...ensuredProperties.get('values'), property ]
}
}
});
Expand Down
Loading