[ACA-4202] - refreshing the preview when version has changed (#6763)

This commit is contained in:
Vito
2021-03-02 17:21:45 +00:00
committed by GitHub
parent 5b75d84115
commit 46edbafb25

View File

@@ -260,7 +260,11 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.apiService.nodeUpdated.pipe( this.apiService.nodeUpdated.pipe(
filter((node) => node && node.id === this.nodeId && node.name !== this.fileName), filter((node) => {
return node && node.id === this.nodeId &&
(node.name !== this.fileName ||
this.getNodeVersionProperty(this.nodeEntry.entry) !== this.getNodeVersionProperty(node));
}),
takeUntil(this.onDestroy$) takeUntil(this.onDestroy$)
).subscribe((node) => this.onNodeUpdated(node)); ).subscribe((node) => this.onNodeUpdated(node));
@@ -284,6 +288,10 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}); });
} }
private getNodeVersionProperty(node: Node): string {
return node?.properties['cm:versionLabel'] ?? '';
}
ngOnDestroy() { ngOnDestroy() {
this.onDestroy$.next(true); this.onDestroy$.next(true);
this.onDestroy$.complete(); this.onDestroy$.complete();