mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-4745] memory leak fixes (#4931)
* fix app-layout component * fix card-view component * fix cloud-layout service * code fixes * code fixes * even more fixes * even more fixes * lint fixes * test fixes * fix code * remove useless pipes * fix code owners * enable spellcheck for cloud components * update test * update test
This commit is contained in:
committed by
Eugenio Romano
parent
e2311ab045
commit
1abb9bfc89
@@ -15,16 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
import { MatSnackBarConfig } from '@angular/material';
|
||||
import { FormBuilder, FormGroup, FormControl } from '@angular/forms';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
templateUrl: './notifications.component.html',
|
||||
styleUrls: ['./notifications.component.scss']
|
||||
})
|
||||
export class NotificationsComponent implements OnInit {
|
||||
export class NotificationsComponent implements OnInit, OnDestroy {
|
||||
|
||||
message = 'I ♥️ ADF';
|
||||
withAction = false;
|
||||
@@ -55,6 +57,8 @@ export class NotificationsComponent implements OnInit {
|
||||
|
||||
defaultDuration = 20000;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private notificationService: NotificationService,
|
||||
private formBuilder: FormBuilder) {
|
||||
this.snackBarConfig.duration = this.defaultDuration;
|
||||
@@ -69,10 +73,15 @@ export class NotificationsComponent implements OnInit {
|
||||
});
|
||||
|
||||
this.configForm.valueChanges
|
||||
.subscribe((configFormValues) =>
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(configFormValues =>
|
||||
this.setSnackBarConfig(configFormValues)
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
setSnackBarConfig(configFormValues: any) {
|
||||
|
Reference in New Issue
Block a user