Skip to content

Commit bde2094

Browse files
authored
fix(leak): unsubscribe was not unsubscribing (#15403)
1 parent 16d2f95 commit bde2094

File tree

28 files changed

+57
-57
lines changed

28 files changed

+57
-57
lines changed

projects/igniteui-angular/src/lib/checkbox/checkbox-base.directive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,14 @@ export class CheckboxBaseDirective implements AfterViewInit {
261261

262262
this.theme = this.themeToken.theme;
263263

264-
const { unsubscribe } = this.themeToken.onChange((theme) => {
264+
const themeChange = this.themeToken.onChange((theme) => {
265265
if (this.theme !== theme) {
266266
this.theme = theme;
267267
this.cdr.detectChanges();
268268
}
269269
});
270270

271-
this.destroyRef.onDestroy(() => unsubscribe);
271+
this.destroyRef.onDestroy(() => themeChange.unsubscribe());
272272
}
273273

274274
/**

projects/igniteui-angular/src/lib/icon/icon.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ export class IgxIconService {
6464
@Optional() private _sanitizer: DomSanitizer,
6565
@Optional() private _httpClient: HttpClient,
6666
@Optional() private _platformUtil: PlatformUtil,
67-
@Optional() @Inject(THEME_TOKEN) private _themeToken: ThemeToken,
67+
@Optional() @Inject(THEME_TOKEN) private _themeToken: ThemeToken | undefined,
6868
@Optional() @Inject(DestroyRef) private _destroyRef: DestroyRef,
6969
@Optional() @Inject(DOCUMENT) protected document: Document,
7070
) {
7171

7272
this.iconLoaded = this._iconLoaded.asObservable();
7373
this.setFamily(this._defaultFamily.name, this._defaultFamily.meta);
7474

75-
const { unsubscribe } = this._themeToken?.onChange((theme) => {
75+
const themeChange = this._themeToken?.onChange((theme) => {
7676
this.setRefsByTheme(theme);
7777
});
7878

79-
this._destroyRef.onDestroy(() => unsubscribe);
79+
this._destroyRef.onDestroy(() => themeChange?.unsubscribe());
8080

8181
if (this._platformUtil?.isBrowser) {
8282
this._domParser = new DOMParser();

src/app/accordion/accordion.sample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ export class AccordionSampleComponent {
4040
) {
4141
this.propertyChangeService.setPanelConfig(this.panelConfig);
4242

43-
const { unsubscribe } =
43+
const propertyChange =
4444
this.propertyChangeService.propertyChanges.subscribe(
4545
(properties) => {
4646
this.properties = properties;
4747
}
4848
);
4949

50-
this.destroyRef.onDestroy(() => unsubscribe);
50+
this.destroyRef.onDestroy(() => propertyChange.unsubscribe());
5151
}
5252
}

src/app/avatar/avatar.sample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ export class AvatarSampleComponent {
7676
) {
7777
this.propertyChangeService.setPanelConfig(this.panelConfig);
7878

79-
const { unsubscribe } =
79+
const propertyChange =
8080
this.propertyChangeService.propertyChanges.subscribe(
8181
(properties) => {
8282
this.properties = properties;
8383
}
8484
);
8585

86-
this.destroyRef.onDestroy(() => unsubscribe);
86+
this.destroyRef.onDestroy(() => propertyChange.unsubscribe());
8787
}
8888
}

src/app/badge/badge.sample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ export class BadgeSampleComponent {
6767
) {
6868
this.propertyChangeService.setPanelConfig(this.panelConfig);
6969

70-
const { unsubscribe } =
70+
const propertyChange =
7171
this.propertyChangeService.propertyChanges.subscribe(
7272
(properties) => {
7373
this.properties = properties;
7474
}
7575
);
7676

77-
this.destroyRef.onDestroy(() => unsubscribe);
77+
this.destroyRef.onDestroy(() => propertyChange.unsubscribe());
7878
}
7979

8080
private variantMap = new Map<string, string>(

src/app/button/button.sample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ export class ButtonSampleComponent implements OnInit {
8383
) {
8484
this.propertyChangeService.setPanelConfig(this.panelConfig);
8585

86-
const { unsubscribe } =
86+
const propertyChange =
8787
this.propertyChangeService.propertyChanges.subscribe(
8888
(properties) => {
8989
this.properties = properties;
9090
}
9191
);
9292

93-
this.destroyRef.onDestroy(() => unsubscribe);
93+
this.destroyRef.onDestroy(() => propertyChange.unsubscribe());
9494
}
9595

9696
public ngOnInit(): void {

src/app/buttonGroup/buttonGroup.sample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,14 @@ export class ButtonGroupSampleComponent {
114114
) {
115115
this.propertyChangeService.setPanelConfig(this.panelConfig);
116116

117-
const { unsubscribe } =
117+
const propertyChange =
118118
this.propertyChangeService.propertyChanges.subscribe(
119119
(properties) => {
120120
this.properties = properties;
121121
}
122122
);
123123

124-
this.destroyRef.onDestroy(() => unsubscribe);
124+
this.destroyRef.onDestroy(() => propertyChange.unsubscribe());
125125
}
126126

127127
private selectionMap = new Map<string, string>(

src/app/calendar/calendar.sample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ export class CalendarSampleComponent implements OnInit {
153153
) {
154154
this.propertyChangeService.setPanelConfig(this.panelConfig);
155155

156-
const { unsubscribe } =
156+
const propertyChange =
157157
this.propertyChangeService.propertyChanges.subscribe(
158158
(properties) => {
159159
this.properties = properties;
160160
}
161161
);
162162

163-
this.destroyRef.onDestroy(() => unsubscribe);
163+
this.destroyRef.onDestroy(() => propertyChange.unsubscribe());
164164
}
165165

166166
public ngOnInit(): void {

src/app/card/card.sample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ export class CardSampleComponent implements OnInit {
162162
) {
163163
this.propertyChangeService.setPanelConfig(this.panelConfig);
164164

165-
const { unsubscribe } =
165+
const propertyChange =
166166
this.propertyChangeService.propertyChanges.subscribe(
167167
(properties) => {
168168
this.properties = properties;
169169
}
170170
);
171171

172-
this.destroyRef.onDestroy(() => unsubscribe);
172+
this.destroyRef.onDestroy(() => propertyChange.unsubscribe());
173173
}
174174

175175
public ngOnInit() {

src/app/carousel/carousel.sample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,14 @@ export class CarouselSampleComponent {
134134
this.addNewSlide();
135135
this.propertyChangeService.setPanelConfig(this.panelConfig);
136136

137-
const { unsubscribe } =
137+
const propertyChange =
138138
this.propertyChangeService.propertyChanges.subscribe(
139139
(properties) => {
140140
this.properties = properties;
141141
}
142142
);
143143

144-
this.destroyRef.onDestroy(() => unsubscribe);
144+
this.destroyRef.onDestroy(() => propertyChange.unsubscribe());
145145
}
146146

147147
private indicatorsOrientationMap = new Map<string, string>([

0 commit comments

Comments
 (0)