Skip to content

Commit

Permalink
[ACS-8091] Testing Angular 15 - The “Create” and “Upload” button from…
Browse files Browse the repository at this point in the history
… Personal Files are sometimes loaded also on Libraries Page if opened quickly (#3881)

* aaaaa

* [ACS-8091] - Testing Angular 15 - The “Create” and “Upload” button from Personal Files are sometimes loaded also on Libraries Page if opened quickly
  • Loading branch information
jacekpluta authored Jun 10, 2024
1 parent 147fca0 commit 9a9aa50
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions projects/aca-content/src/lib/components/files/files.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,29 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {

this.title = data.title;

this.route.queryParamMap.subscribe((queryMap: Params) => {
this.route.queryParamMap.pipe(takeUntil(this.onDestroy$)).subscribe((queryMap: Params) => {
this.queryParams = queryMap.params;
});
this.route.params.subscribe(({ folderId }: Params) => {
this.route.params.pipe(takeUntil(this.onDestroy$)).subscribe(({ folderId }: Params) => {
const nodeId = folderId || data.defaultNodeId;

this.contentApi.getNode(nodeId).subscribe(
(node) => {
this.isValidPath = true;

if (node?.entry?.isFolder) {
void this.updateCurrentNode(node.entry);
} else {
void this.router.navigate(['/personal-files', node.entry.parentId], {
replaceUrl: true
});
}
},
() => (this.isValidPath = false)
);
this.contentApi
.getNode(nodeId)
.pipe(takeUntil(this.onDestroy$))
.subscribe(
(node) => {
this.isValidPath = true;

if (node?.entry?.isFolder) {
void this.updateCurrentNode(node.entry);
} else {
void this.router.navigate(['/personal-files', node.entry.parentId], {
replaceUrl: true
});
}
},
() => (this.isValidPath = false)
);
});

this.subscriptions = this.subscriptions.concat([
Expand Down

0 comments on commit 9a9aa50

Please sign in to comment.