Skip to content

Commit 7e57e2d

Browse files
committed
refactor: safe ?.unsubscribe() from subscriptions
1 parent 276ff91 commit 7e57e2d

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

projects/coreui-angular/src/lib/dropdown/dropdown-menu/dropdown-menu.directive.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class DropdownMenuDirective implements OnInit, OnDestroy {
7878
}
7979
});
8080
} else {
81-
this.dropdownStateSubscription.unsubscribe();
81+
this.dropdownStateSubscription?.unsubscribe();
8282
}
8383
}
8484
}

projects/coreui-angular/src/lib/dropdown/dropdown/dropdown.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ export class DropdownComponent implements AfterContentInit, OnChanges, OnDestroy
312312
}
313313
});
314314
} else {
315-
this.dropdownStateSubscription.unsubscribe();
315+
this.dropdownStateSubscription?.unsubscribe();
316316
}
317317
}
318318

projects/coreui-angular/src/lib/modal/modal/modal.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export class ModalComponent implements OnInit, OnDestroy {
276276
}
277277
);
278278
} else {
279-
this.stateToggleSubscription.unsubscribe();
279+
this.stateToggleSubscription?.unsubscribe();
280280
}
281281
}
282282

projects/coreui-angular/src/lib/offcanvas/offcanvas/offcanvas.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export class OffcanvasComponent implements OnInit, OnDestroy {
269269
}
270270
});
271271
} else {
272-
this.#stateToggleSubscription.unsubscribe();
272+
this.#stateToggleSubscription?.unsubscribe();
273273
}
274274
}
275275

projects/coreui-angular/src/lib/sidebar/sidebar-nav/sidebar-nav-link.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class SidebarNavLinkComponent implements OnInit, OnDestroy {
9595
}
9696

9797
ngOnDestroy(): void {
98-
this.navSubscription.unsubscribe();
98+
this.navSubscription?.unsubscribe();
9999
}
100100

101101
public getLinkType(): string {

projects/coreui-angular/src/lib/sidebar/sidebar-nav/sidebar-nav.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class SidebarNavGroupComponent implements OnInit, OnDestroy {
161161
}
162162

163163
ngOnDestroy(): void {
164-
this.navSubscription.unsubscribe();
164+
this.navSubscription?.unsubscribe();
165165
}
166166

167167
onAnimationStart($event: AnimationEvent) {

projects/coreui-angular/src/lib/sidebar/sidebar/sidebar.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
285285
}
286286
);
287287
} else {
288-
this.#layoutChangeSubscription.unsubscribe();
288+
this.#layoutChangeSubscription?.unsubscribe();
289289
}
290290
}
291291
}

projects/coreui-angular/src/lib/toast/toaster/toaster.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class ToasterComponent implements OnDestroy, OnInit, AfterContentChecked
169169
}
170170
});
171171
} else {
172-
this.stateToasterSubscription.unsubscribe();
172+
this.stateToasterSubscription?.unsubscribe();
173173
}
174174
}
175175
}

0 commit comments

Comments
 (0)