63184: Relationship list refreshing fix - Re-initializing itemUpdateSubscription

This commit is contained in:
Kristof De Langhe
2019-06-27 11:55:10 +02:00
parent 2f6c0fb126
commit 417f79ab6a

View File

@@ -66,8 +66,13 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent impl
ngOnInit(): void { ngOnInit(): void {
super.ngOnInit(); super.ngOnInit();
this.relationLabels$ = this.relationshipService.getItemRelationshipLabels(this.item); this.relationLabels$ = this.relationshipService.getItemRelationshipLabels(this.item);
this.initializeItemUpdate();
}
// Update the item (and view) when it's removed in the request cache /**
* Update the item (and view) when it's removed in the request cache
*/
public initializeItemUpdate(): void {
this.itemUpdateSubscription = this.requestService.hasByHrefObservable(this.item.self).pipe( this.itemUpdateSubscription = this.requestService.hasByHrefObservable(this.item.self).pipe(
filter((exists: boolean) => !exists), filter((exists: boolean) => !exists),
switchMap(() => this.itemService.findById(this.item.uuid)), switchMap(() => this.itemService.findById(this.item.uuid)),
@@ -144,11 +149,12 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent impl
} }
/** /**
* Reset the state of editing relationships * Re-initialize fields and subscriptions
*/ */
reset() { reset() {
this.initializeOriginalFields(); this.initializeOriginalFields();
this.initializeUpdates(); this.initializeUpdates();
this.initializeItemUpdate();
} }
/** /**