Skip to content

Commit 4a70382

Browse files
115046: Fixed incorrect name variant being saved in the store when marking relationship ready for deletion
1 parent c687d3f commit 4a70382

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
@@ -305,16 +305,16 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
305305
modalComp.submitEv = () => {
306306
modalComp.isPending = true;
307307
const isLeft = this.currentItemIsLeftItem$.getValue();
308-
const addOperations = modalComp.toAdd.map((searchResult: any) => ({ type: 'add', searchResult }));
309-
const removeOperations = modalComp.toRemove.map((searchResult: any) => ({ type: 'remove', searchResult }));
308+
const addOperations = modalComp.toAdd.map((searchResult: ItemSearchResult) => ({ type: 'add', searchResult }));
309+
const removeOperations = modalComp.toRemove.map((searchResult: ItemSearchResult) => ({ type: 'remove', searchResult }));
310310
observableFrom([...addOperations, ...removeOperations]).pipe(
311-
concatMap(({ type, searchResult }: { type: string, searchResult: any }) => {
311+
concatMap(({ type, searchResult }: { type: string, searchResult: ItemSearchResult }) => {
312+
const relatedItem: Item = searchResult.indexableObject;
312313
if (type === 'add') {
313-
const relatedItem = searchResult.indexableObject;
314314
return this.relationshipService.getNameVariant(this.listId, relatedItem.uuid).pipe(
315315
map((nameVariant) => {
316316
const update = {
317-
uuid: this.relationshipType.id + '-' + searchResult.indexableObject.uuid,
317+
uuid: `${this.relationshipType.id}-${relatedItem.uuid}`,
318318
nameVariant,
319319
type: this.relationshipType,
320320
originalIsLeft: isLeft,
@@ -327,7 +327,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
327327
take(1)
328328
);
329329
} else if (type === 'remove') {
330-
return this.relationshipService.getNameVariant(this.listId, searchResult.indexableObjectuuid).pipe(
330+
return this.relationshipService.getNameVariant(this.listId, relatedItem.uuid).pipe(
331331
switchMap((nameVariant) => {
332332
return this.getRelationFromId(searchResult.indexableObject).pipe(
333333
map( (relationship: Relationship) => {

0 commit comments

Comments
 (0)