From 63fc8f04680aa68b5d6e26de4706f17dc119261a Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Thu, 16 Nov 2023 14:54:35 +0200 Subject: [PATCH] RED-3800: changed mutate to update. --- .../file-attribute.component.ts | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts b/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts index 2e700a09e..4aae239d4 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts @@ -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); - } - } - }); + }), + ), + ); } }