diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts index 6c3b8d556a4..15fec857668 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts @@ -335,16 +335,16 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy { modalComp.submitEv = () => { modalComp.isPending = true; const isLeft = this.currentItemIsLeftItem$.getValue(); - const addOperations = modalComp.toAdd.map((searchResult: any) => ({ type: 'add', searchResult })); - const removeOperations = modalComp.toRemove.map((searchResult: any) => ({ type: 'remove', searchResult })); + const addOperations = modalComp.toAdd.map((searchResult: ItemSearchResult) => ({ type: 'add', searchResult })); + const removeOperations = modalComp.toRemove.map((searchResult: ItemSearchResult) => ({ type: 'remove', searchResult })); observableFrom([...addOperations, ...removeOperations]).pipe( - concatMap(({ type, searchResult }: { type: string, searchResult: any }) => { + concatMap(({ type, searchResult }: { type: string, searchResult: ItemSearchResult }) => { + const relatedItem: Item = searchResult.indexableObject; if (type === 'add') { - const relatedItem = searchResult.indexableObject; return this.relationshipService.getNameVariant(this.listId, relatedItem.uuid).pipe( map((nameVariant) => { const update = { - uuid: this.relationshipType.id + '-' + searchResult.indexableObject.uuid, + uuid: `${this.relationshipType.id}-${relatedItem.uuid}`, nameVariant, type: this.relationshipType, originalIsLeft: isLeft, @@ -357,7 +357,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy { take(1), ); } else if (type === 'remove') { - return this.relationshipService.getNameVariant(this.listId, searchResult.indexableObjectuuid).pipe( + return this.relationshipService.getNameVariant(this.listId, relatedItem.uuid).pipe( switchMap((nameVariant) => { return this.getRelationFromId(searchResult.indexableObject).pipe( map( (relationship: Relationship) => {