Skip to content

Commit bb00dc3

Browse files
committed
fix: menu service subscription leak + minor refactor
1 parent 9ea672d commit bb00dc3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/services/menu.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface MenuItem {
3535
active?: boolean;
3636
ready?: boolean;
3737

38-
depth?: number;
38+
depth?: string|number;
3939
flatIdx?: number;
4040

4141
metadata?: any;
@@ -72,7 +72,11 @@ export class MenuService {
7272
this.buildMenu();
7373
});
7474

75-
this._scrollSubscription = scrollService.scroll.subscribe((evt) => {
75+
this.subscribe();
76+
}
77+
78+
subscribe() {
79+
this._scrollSubscription = this.scrollService.scroll.subscribe((evt) => {
7680
this.onScroll(evt.isScrolledDown);
7781
});
7882

@@ -478,5 +482,6 @@ export class MenuService {
478482
destroy() {
479483
this._hashSubscription.unsubscribe();
480484
this._scrollSubscription.unsubscribe();
485+
this._progressSubscription.unsubscribe();
481486
}
482487
}

0 commit comments

Comments
 (0)