mirror of
https://github.com/Redocly/redoc.git
synced 2025-07-10 16:22:27 +03:00
fix: subscription leak in side-menu
This commit is contained in:
parent
2409577e2f
commit
838f23380c
|
@ -57,6 +57,9 @@ export class SideMenu implements OnInit, OnDestroy {
|
||||||
private $resourcesNav: any;
|
private $resourcesNav: any;
|
||||||
private $scrollParent: any;
|
private $scrollParent: any;
|
||||||
|
|
||||||
|
private changedActiveSubscription;
|
||||||
|
private changedSubscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
elementRef:ElementRef,
|
elementRef:ElementRef,
|
||||||
private scrollService:ScrollService,
|
private scrollService:ScrollService,
|
||||||
|
@ -71,8 +74,10 @@ export class SideMenu implements OnInit, OnDestroy {
|
||||||
|
|
||||||
this.options = optionsService.options;
|
this.options = optionsService.options;
|
||||||
|
|
||||||
this.menuService.changedActiveItem.subscribe((evt) => this.changed(evt));
|
this.changedActiveSubscription = this.menuService.changedActiveItem.subscribe((evt) => this.changed(evt));
|
||||||
this.menuService.changed.subscribe((evt) => this.detectorRef.detectChanges());
|
this.changedSubscription = this.menuService.changed.subscribe((evt) => {
|
||||||
|
this.detectorRef.detectChanges()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
changed(item) {
|
changed(item) {
|
||||||
|
@ -141,6 +146,8 @@ export class SideMenu implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
|
this.changedActiveSubscription.unsubscribe();
|
||||||
|
this.changedSubscription.unsubscribe();
|
||||||
this.scrollService.unbind();
|
this.scrollService.unbind();
|
||||||
this.menuService.destroy();
|
this.menuService.destroy();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user