Merge branch 'nicoleta' into 'master'
RED-3800: changed mutate to update. See merge request redactmanager/red-ui!191
This commit is contained in:
commit
5fe11a1475
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,11 +35,11 @@ export class REDAnnotationManager {
|
||||
}
|
||||
|
||||
addToHidden(value: string) {
|
||||
this.#hidden.mutate(set => set.add(value));
|
||||
this.#hidden.update(set => new Set([...set, value]));
|
||||
}
|
||||
|
||||
removeFromHidden(value: string) {
|
||||
this.#hidden.mutate(set => set.delete(value));
|
||||
this.#hidden.update(set => new Set([...set].filter(val => value !== val)));
|
||||
}
|
||||
|
||||
init(annotationManager: AnnotationManager) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user