mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
fix loop for name variants as well
This commit is contained in:
@@ -236,6 +236,7 @@ export abstract class DataService<T extends CacheableObject> {
|
||||
console.log(oldVersion);
|
||||
const operations = this.comparator.diff(oldVersion, object);
|
||||
if (isNotEmpty(operations)) {
|
||||
console.log('operations', operations);
|
||||
this.objectCache.addPatch(object.self, operations);
|
||||
}
|
||||
return this.findByHref(object.self);
|
||||
|
@@ -333,7 +333,7 @@ export class RelationshipService extends DataService<Relationship> {
|
||||
}
|
||||
|
||||
public updateNameVariant(item1: Item, item2: Item, relationshipLabel: string, nameVariant: string): Observable<RemoteData<Relationship>> {
|
||||
return this.getRelationshipByItemsAndLabel(item1, item2, relationshipLabel)
|
||||
const update$ = this.getRelationshipByItemsAndLabel(item1, item2, relationshipLabel)
|
||||
.pipe(
|
||||
switchMap((relation: Relationship) =>
|
||||
relation.relationshipType.pipe(
|
||||
@@ -354,13 +354,17 @@ export class RelationshipService extends DataService<Relationship> {
|
||||
}
|
||||
return this.update(updatedRelationship);
|
||||
}),
|
||||
tap((relationshipRD: RemoteData<Relationship>) => {
|
||||
if (relationshipRD.hasSucceeded) {
|
||||
this.removeRelationshipItemsFromCache(item1);
|
||||
this.removeRelationshipItemsFromCache(item2);
|
||||
}
|
||||
}),
|
||||
)
|
||||
);
|
||||
|
||||
update$.pipe(
|
||||
filter((relationshipRD: RemoteData<Relationship>) => relationshipRD.state === RemoteDataState.ResponsePending),
|
||||
take(1),
|
||||
).subscribe(() => {
|
||||
this.removeRelationshipItemsFromCache(item1);
|
||||
this.removeRelationshipItemsFromCache(item2);
|
||||
});
|
||||
|
||||
return update$
|
||||
}
|
||||
|
||||
public updatePlace(reoRel: ReorderableRelationship): Observable<RemoteData<Relationship>> {
|
||||
|
@@ -3,6 +3,7 @@ import { Actions, Effect, ofType } from '@ngrx/effects';
|
||||
import { debounceTime, map, mergeMap, take, tap } from 'rxjs/operators';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { RelationshipService } from '../../../../../core/data/relationship.service';
|
||||
import { getSucceededRemoteData } from '../../../../../core/shared/operators';
|
||||
import { AddRelationshipAction, RelationshipAction, RelationshipActionTypes, RemoveRelationshipAction, UpdateRelationshipAction } from './relationship.actions';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { hasNoValue, hasValue, hasValueOperator } from '../../../../empty.util';
|
||||
@@ -83,7 +84,7 @@ export class RelationshipEffects {
|
||||
this.nameVariantUpdates[identifier] = nameVariant;
|
||||
} else {
|
||||
this.relationshipService.updateNameVariant(item1, item2, relationshipType, nameVariant)
|
||||
.pipe()
|
||||
.pipe(getSucceededRemoteData())
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user