From 9a9aa50eae1b9dc7c95fbda41d895ccbe176f6b4 Mon Sep 17 00:00:00 2001 From: jacekpluta <73617938+jacekpluta@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:56:54 +0200 Subject: [PATCH] =?UTF-8?q?[ACS-8091]=20Testing=20Angular=2015=20-=20The?= =?UTF-8?q?=20=E2=80=9CCreate=E2=80=9D=20and=20=E2=80=9CUpload=E2=80=9D=20?= =?UTF-8?q?button=20from=20Personal=20Files=20are=20sometimes=20loaded=20a?= =?UTF-8?q?lso=20on=20Libraries=20Page=20if=20opened=20quickly=20(#3881)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * aaaaa * [ACS-8091] - Testing Angular 15 - The “Create” and “Upload” button from Personal Files are sometimes loaded also on Libraries Page if opened quickly --- .../lib/components/files/files.component.ts | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/projects/aca-content/src/lib/components/files/files.component.ts b/projects/aca-content/src/lib/components/files/files.component.ts index e4e083183a..4826809776 100644 --- a/projects/aca-content/src/lib/components/files/files.component.ts +++ b/projects/aca-content/src/lib/components/files/files.component.ts @@ -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([