RED-3800: changed mutate to update.

This commit is contained in:
Nicoleta Panaghiu 2023-11-16 14:54:35 +02:00
parent bb83b90ae0
commit 63fc8f0468

View File

@ -139,9 +139,10 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
!this.isInEditMode
) {
$event.stopPropagation();
this.fileAttributesService.openAttributeEdits.mutate(value =>
value.push({ attribute: this.fileAttribute.id, file: this.file.id }),
);
this.fileAttributesService.openAttributeEdits.update(value => [
...value,
{ attribute: this.fileAttribute.id, file: this.file.id },
]);
this.#toggleEdit();
this.fileAttributesService.setFileEdit(this.file.fileId);
this.fileAttributesService.setOpenAttributeEdit(this.fileAttribute.id);
@ -173,19 +174,16 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
if (this.isInEditMode) {
this.form = this.#getForm();
this.#toggleEdit();
this.fileAttributesService.openAttributeEdits.mutate(value => {
for (let index = 0; index < value.length; index++) {
if (
JSON.stringify(value[index]) ===
this.fileAttributesService.openAttributeEdits.update(value =>
value.filter(
val =>
JSON.stringify(val) !==
JSON.stringify({
attribute: this.fileAttribute.id,
file: this.file.id,
})
) {
value.splice(index, 1);
}
}
});
}),
),
);
}
}