Skip to content

Commit 05117f3

Browse files
Copilotbarmac
andcommitted
Fix eslint-plugin-react-hooks v7 immutability errors
Co-authored-by: barmac <[email protected]>
1 parent d48b35b commit 05117f3

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/provider/camunda-platform/properties/FormField.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,9 @@ function ConstraintList(props) {
424424
const commands = [];
425425

426426
// (1) ensure validation
427-
if (!validation) {
428-
validation = createElement(
427+
let ensuredValidation = validation;
428+
if (!ensuredValidation) {
429+
ensuredValidation = createElement(
429430
'camunda:Validation',
430431
{ },
431432
businessObject,
@@ -437,7 +438,7 @@ function ConstraintList(props) {
437438
context: {
438439
element,
439440
moddleElement: formField,
440-
properties: { validation }
441+
properties: { validation: ensuredValidation }
441442
}
442443
});
443444
}
@@ -446,17 +447,17 @@ function ConstraintList(props) {
446447
const constraint = createElement(
447448
'camunda:Constraint',
448449
{ name: undefined, config: undefined },
449-
validation,
450+
ensuredValidation,
450451
bpmnFactory
451452
);
452453

453454
commands.push({
454455
cmd: 'element.updateModdleProperties',
455456
context: {
456457
element,
457-
moddleElement: validation,
458+
moddleElement: ensuredValidation,
458459
properties: {
459-
constraints: [ ...validation.get('constraints'), constraint ]
460+
constraints: [ ...ensuredValidation.get('constraints'), constraint ]
460461
}
461462
}
462463
});
@@ -539,8 +540,9 @@ function PropertiesList(props) {
539540
const commands = [];
540541

541542
// (1) ensure properties
542-
if (!properties) {
543-
properties = createElement(
543+
let ensuredProperties = properties;
544+
if (!ensuredProperties) {
545+
ensuredProperties = createElement(
544546
'camunda:Properties',
545547
{ },
546548
businessObject,
@@ -552,7 +554,7 @@ function PropertiesList(props) {
552554
context: {
553555
element,
554556
moddleElement: formField,
555-
properties: { properties }
557+
properties: { properties: ensuredProperties }
556558
}
557559
});
558560
}
@@ -561,17 +563,17 @@ function PropertiesList(props) {
561563
const property = createElement(
562564
'camunda:Property',
563565
{ id: undefined, value: undefined },
564-
properties,
566+
ensuredProperties,
565567
bpmnFactory
566568
);
567569

568570
commands.push({
569571
cmd: 'element.updateModdleProperties',
570572
context: {
571573
element,
572-
moddleElement: properties,
574+
moddleElement: ensuredProperties,
573575
properties: {
574-
values: [ ...properties.get('values'), property ]
576+
values: [ ...ensuredProperties.get('values'), property ]
575577
}
576578
}
577579
});

0 commit comments

Comments
 (0)