fix Flickering viewer toolbar icons when navigating to next/previous files (#2074)

This commit is contained in:
Eugenio Romano
2021-04-15 15:15:49 +01:00
committed by GitHub
parent 486e08d215
commit 5340745fcb
+11 -5
View File
@@ -131,8 +131,13 @@ export class AppViewerComponent implements OnInit, OnDestroy {
.subscribe((ruleContext) => { .subscribe((ruleContext) => {
this.selection = ruleContext.selection; this.selection = ruleContext.selection;
if (this.toolbarActions.length === 0) {
this.toolbarActions = this.extensions.getViewerToolbarActions(); this.toolbarActions = this.extensions.getViewerToolbarActions();
}
if (this.openWith.length === 0) {
this.openWith = this.extensions.openWithActions; this.openWith = this.extensions.openWithActions;
}
}); });
this.route.params.subscribe((params) => { this.route.params.subscribe((params) => {
@@ -200,18 +205,19 @@ export class AppViewerComponent implements OnInit, OnDestroy {
return obj.id; return obj.id;
} }
async displayNode(id: string) { async displayNode(nodeId: string) {
if (id) { if (nodeId) {
try { try {
this.node = await this.contentApi.getNodeInfo(id).toPromise(); this.node = await this.contentApi.getNodeInfo(nodeId).toPromise();
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }])); this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
if (this.node && this.node.isFile) { if (this.node && this.node.isFile) {
this.nodeId = this.node.id;
const nearest = await this.getNearestNodes(this.node.id, this.node.parentId); const nearest = await this.getNearestNodes(this.node.id, this.node.parentId);
this.previousNodeId = nearest.left; this.previousNodeId = nearest.left;
this.nextNodeId = nearest.right; this.nextNodeId = nearest.right;
this.nodeId = this.node.id;
this.fileName = this.node.name + this.node?.properties?.['cm:versionLabel']; this.fileName = this.node.name + this.node?.properties?.['cm:versionLabel'];
return; return;
} }
@@ -220,7 +226,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
if (statusCode !== 401) { if (statusCode !== 401) {
this.router.navigate([this.previewLocation, { outlets: { viewer: null } }]).then(() => { this.router.navigate([this.previewLocation, { outlets: { viewer: null } }]).then(() => {
this.router.navigate([this.previewLocation, id]); this.router.navigate([this.previewLocation, nodeId]);
}); });
} }
} }