Skip to content

Commit a596af0

Browse files
115046: Fixed incorrect name variant being saved in the store when marking relationship ready for deletion
1 parent 58bcb9b commit a596af0

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,16 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
335335
modalComp.submitEv = () => {
336336
modalComp.isPending = true;
337337
const isLeft = this.currentItemIsLeftItem$.getValue();
338-
const addOperations = modalComp.toAdd.map((searchResult: any) => ({ type: 'add', searchResult }));
339-
const removeOperations = modalComp.toRemove.map((searchResult: any) => ({ type: 'remove', searchResult }));
338+
const addOperations = modalComp.toAdd.map((searchResult: ItemSearchResult) => ({ type: 'add', searchResult }));
339+
const removeOperations = modalComp.toRemove.map((searchResult: ItemSearchResult) => ({ type: 'remove', searchResult }));
340340
observableFrom([...addOperations, ...removeOperations]).pipe(
341-
concatMap(({ type, searchResult }: { type: string, searchResult: any }) => {
341+
concatMap(({ type, searchResult }: { type: string, searchResult: ItemSearchResult }) => {
342+
const relatedItem: Item = searchResult.indexableObject;
342343
if (type === 'add') {
343-
const relatedItem = searchResult.indexableObject;
344344
return this.relationshipService.getNameVariant(this.listId, relatedItem.uuid).pipe(
345345
map((nameVariant) => {
346346
const update = {
347-
uuid: this.relationshipType.id + '-' + searchResult.indexableObject.uuid,
347+
uuid: `${this.relationshipType.id}-${relatedItem.uuid}`,
348348
nameVariant,
349349
type: this.relationshipType,
350350
originalIsLeft: isLeft,
@@ -357,7 +357,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
357357
take(1),
358358
);
359359
} else if (type === 'remove') {
360-
return this.relationshipService.getNameVariant(this.listId, searchResult.indexableObjectuuid).pipe(
360+
return this.relationshipService.getNameVariant(this.listId, relatedItem.uuid).pipe(
361361
switchMap((nameVariant) => {
362362
return this.getRelationFromId(searchResult.indexableObject).pipe(
363363
map( (relationship: Relationship) => {

0 commit comments

Comments
 (0)