File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
projects/stream-chat-angular/src/lib Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1557,11 +1557,15 @@ export class ChannelService<
1557
1557
1558
1558
if ( this . customChannelQuery ) {
1559
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
- ) ;
1560
+ const cids = new Set < string > ( ) ;
1561
+ const filteredChannels = result . channels . filter ( ( c ) => {
1562
+ if ( cids . has ( c . cid ) ) {
1563
+ return false ;
1564
+ } else {
1565
+ cids . add ( c . cid ) ;
1566
+ return true ;
1567
+ }
1568
+ } ) ;
1565
1569
this . channelManager . setChannels ( filteredChannels ) ;
1566
1570
this . hasMoreChannelsSubject . next ( result . hasMorePage ) ;
1567
1571
} else {
You can’t perform that action at this time.
0 commit comments