From 1c3ae4fc24cea4736915767c60cf9f1543ff1197 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Mon, 13 Nov 2023 08:55:19 +0100 Subject: [PATCH] fix: don't call stop watch for deleted channel --- projects/stream-chat-angular/src/lib/channel.service.spec.ts | 2 +- projects/stream-chat-angular/src/lib/channel.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/stream-chat-angular/src/lib/channel.service.spec.ts b/projects/stream-chat-angular/src/lib/channel.service.spec.ts index e05215bd..dc29b410 100644 --- a/projects/stream-chat-angular/src/lib/channel.service.spec.ts +++ b/projects/stream-chat-angular/src/lib/channel.service.spec.ts @@ -752,7 +752,7 @@ describe('ChannelService', () => { const channels = spy.calls.mostRecent().args[0] as Channel[]; expect(channels.find((c) => c.cid === channel.cid)).toBeUndefined(); - expect(channel.stopWatching).toHaveBeenCalledWith(); + expect(channel.stopWatching).not.toHaveBeenCalledWith(); }); it('should call #customChannelDeletedHandler, if channel is deleted and handler is provided', async () => { diff --git a/projects/stream-chat-angular/src/lib/channel.service.ts b/projects/stream-chat-angular/src/lib/channel.service.ts index 2d665b4c..39e378b5 100644 --- a/projects/stream-chat-angular/src/lib/channel.service.ts +++ b/projects/stream-chat-angular/src/lib/channel.service.ts @@ -1640,7 +1640,7 @@ export class ChannelService< } private handleChannelDeleted(event: Event) { - this.removeChannelsFromChannelList([event.channel!.cid], true); + this.removeChannelsFromChannelList([event.channel!.cid], false); } private handleChannelVisible(event: Event, channel: Channel) {