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 f313b313..b912b5cb 100644 --- a/projects/stream-chat-angular/src/lib/channel.service.spec.ts +++ b/projects/stream-chat-angular/src/lib/channel.service.spec.ts @@ -1860,6 +1860,7 @@ describe('ChannelService', () => { john: { user: { id: 'john' } }, [user.id]: { user }, } as any as Record; + channel.data = { member_count: 3, own_capabilities: [] }; service.setAsActiveChannel(channel); const result = await service.autocompleteMembers('ja'); const expectedResult = [ diff --git a/projects/stream-chat-angular/src/lib/channel.service.ts b/projects/stream-chat-angular/src/lib/channel.service.ts index 1920395c..9279cd65 100644 --- a/projects/stream-chat-angular/src/lib/channel.service.ts +++ b/projects/stream-chat-angular/src/lib/channel.service.ts @@ -1084,7 +1084,7 @@ export class ChannelService { } /** - * Returns the autocomplete options for current channel members. If the channel has less than 100 members, it returns the channel members, otherwise sends a [search request](/chat/docs/javascript/query_members/#pagination-and-ordering) with the given search term. + * Returns the autocomplete options for current channel members. If member_count is equal to the number of members in the channel, it returns the channel members, otherwise sends a [search request](/chat/docs/javascript/query_members/#pagination-and-ordering) with the given search term. * @param searchTerm Text to search for in the names of members * @returns The list of members matching the search filter */ @@ -1093,7 +1093,10 @@ export class ChannelService { if (!activeChannel) { return []; } - if (Object.keys(activeChannel.state.members).length < 100) { + if ( + Object.keys(activeChannel.state.members).length === + (activeChannel.data?.member_count ?? 0) + ) { return Object.values(activeChannel.state.members).filter( (m) => m.user?.id !== this.chatClientService.chatClient.userID! );