mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
remove memory leak for mobile screens (#744)
This commit is contained in:
committed by
Cilibiu Bogdan
parent
c75943988a
commit
a6c420b54f
@@ -56,6 +56,8 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|||||||
layout: SidenavLayoutComponent;
|
layout: SidenavLayoutComponent;
|
||||||
|
|
||||||
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
||||||
|
isSmallScreen$: Observable<boolean>;
|
||||||
|
|
||||||
expandedSidenav: boolean;
|
expandedSidenav: boolean;
|
||||||
currentFolderId: string;
|
currentFolderId: string;
|
||||||
canUpload = false;
|
canUpload = false;
|
||||||
@@ -76,6 +78,10 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.isSmallScreen$ = this.breakpointObserver
|
||||||
|
.observe(['(max-width: 600px)'])
|
||||||
|
.pipe(map(result => result.matches));
|
||||||
|
|
||||||
this.hideSidenav = this.hideConditions.some(el =>
|
this.hideSidenav = this.hideConditions.some(el =>
|
||||||
this.router.routerState.snapshot.url.includes(el)
|
this.router.routerState.snapshot.url.includes(el)
|
||||||
);
|
);
|
||||||
@@ -96,11 +102,12 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.router.events
|
this.router.events
|
||||||
.pipe(
|
.pipe(
|
||||||
withLatestFrom(this.isSmallScreen()),
|
withLatestFrom(this.isSmallScreen$),
|
||||||
filter(
|
filter(
|
||||||
([event, isSmallScreen]) =>
|
([event, isSmallScreen]) =>
|
||||||
isSmallScreen && event instanceof NavigationEnd
|
isSmallScreen && event instanceof NavigationEnd
|
||||||
)
|
),
|
||||||
|
takeUntil(this.onDestroy$)
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.layout.container.toggleMenu();
|
this.layout.container.toggleMenu();
|
||||||
@@ -170,10 +177,4 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
return expand;
|
return expand;
|
||||||
}
|
}
|
||||||
|
|
||||||
private isSmallScreen(): Observable<boolean> {
|
|
||||||
return this.breakpointObserver
|
|
||||||
.observe(['(max-width: 600px)'])
|
|
||||||
.pipe(map(result => result.matches));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user