fix details component destruction

This commit is contained in:
Denys Vuika
2023-05-25 21:59:53 +01:00
parent 39aa789712
commit 304677e722

View File

@@ -22,11 +22,10 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>. * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core'; import { Component, OnInit, ViewEncapsulation, OnDestroy, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { ContentApiService, PageComponent } from '@alfresco/aca-shared'; import { ContentApiService, PageComponent } from '@alfresco/aca-shared';
import { NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store'; import { NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { Subject } from 'rxjs';
@Component({ @Component({
selector: 'app-details-manager', selector: 'app-details-manager',
@@ -35,20 +34,18 @@ import { Subject } from 'rxjs';
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class DetailsComponent extends PageComponent implements OnInit, OnDestroy { export class DetailsComponent extends PageComponent implements OnInit, OnDestroy {
private route = inject(ActivatedRoute);
private contentApi = inject(ContentApiService);
nodeId: string; nodeId: string;
isLoading: boolean; isLoading: boolean;
onDestroy$ = new Subject<boolean>();
activeTab = 1; activeTab = 1;
constructor(private route: ActivatedRoute, private contentApi: ContentApiService) {
super();
}
ngOnInit(): void { ngOnInit(): void {
super.ngOnInit(); super.ngOnInit();
this.isLoading = true; this.isLoading = true;
const { route } = this; const { data } = this.route.snapshot;
const { data } = route.snapshot;
this.title = data.title; this.title = data.title;
this.route.params.subscribe((params) => { this.route.params.subscribe((params) => {
@@ -82,8 +79,6 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.store.dispatch(new SetSelectedNodesAction([])); super.ngOnDestroy();
this.onDestroy$.next();
this.onDestroy$.complete();
} }
} }