Skip to content

Commit

Permalink
115046: Fixed incorrect name variant being saved in the store when ma…
Browse files Browse the repository at this point in the history
…rking relationship ready for deletion
  • Loading branch information
alexandrevryghem committed May 30, 2024
1 parent 58bcb9b commit a596af0
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) => {
Expand Down

0 comments on commit a596af0

Please sign in to comment.