diff --git a/projects/stream-chat-angular/src/lib/avatar/avatar.component.ts b/projects/stream-chat-angular/src/lib/avatar/avatar.component.ts index c02d2a0d..b29df72d 100644 --- a/projects/stream-chat-angular/src/lib/avatar/avatar.component.ts +++ b/projects/stream-chat-angular/src/lib/avatar/avatar.component.ts @@ -5,6 +5,7 @@ import { Input, NgZone, OnChanges, + OnDestroy, OnInit, SimpleChanges, } from '@angular/core'; @@ -27,7 +28,7 @@ import { styleUrls: ['./avatar.component.scss'], }) export class AvatarComponent - implements OnChanges, OnInit, OnChanges, AfterViewInit + implements OnChanges, OnInit, OnChanges, AfterViewInit, OnDestroy { /** * An optional name of the image, used for fallback image or image title (if `imageUrl` is provided) @@ -113,6 +114,10 @@ export class AvatarComponent } } + ngOnDestroy(): void { + this.subscriptions.forEach((s) => s.unsubscribe()); + } + private setFallbackChannelImage() { if (this.type !== 'channel') { this.fallbackChannelImage = undefined;