1
0

115046: Fixed incorrect name variant being saved in the store when marking relationship ready for deletion

This commit is contained in:
Alexandre Vryghem
2024-05-28 13:38:23 +02:00
parent c687d3ff5d
commit 4a70382072

View File

@@ -305,16 +305,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,
@@ -327,7 +327,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) => {