We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 466b82c commit 8e853fcCopy full SHA for 8e853fc
1 file changed
projects/stream-chat-angular/src/lib/channel.service.ts
@@ -1557,11 +1557,15 @@ export class ChannelService<
1557
1558
if (this.customChannelQuery) {
1559
const result = await this.customChannelQuery(queryType);
1560
- const currentChannels = this.channels;
1561
- const filteredChannels = result.channels.filter(
1562
- (channel, index) =>
1563
- !currentChannels.slice(0, index).find((c) => c.cid === channel.cid),
1564
- );
+ const cids = new Set<string>();
+ const filteredChannels = result.channels.filter((c) => {
+ if (cids.has(c.cid)) {
+ return false;
+ } else {
1565
+ cids.add(c.cid);
1566
+ return true;
1567
+ }
1568
+ });
1569
this.channelManager.setChannels(filteredChannels);
1570
this.hasMoreChannelsSubject.next(result.hasMorePage);
1571
} else {
0 commit comments