Hello @BizimplyHan
Welcome to the Sendbird Community!
When fetching a large user list with React UI Kit, it is not recommended to fetch all users at once regardless of the limit. Fetching a large number of users in a single API call can cause performance issues and slow down your application.
Instead, you can use pagination to fetch users in smaller batches. The ApplicationUserListQuery
instance provides a limit
parameter that allows you to specify the number of users to retrieve in each API call. You can set the limit
parameter to a value that suits your needs, such as 100 or 200.
Here’s an example of how you can fetch a multi-thousand user list using pagination with React UI Kit:
const queryParams: ApplicationUserListQueryParams = {
limit: 100, // Set the limit to the desired value
};
const query = sb.createApplicationUserListQuery(queryParams);
const users = await query.next();
You can then use the next()
method of the query instance to fetch the next batch of users. Repeat this process until you have fetched all the users.
Similarly, when fetching channel lists, you can use pagination to fetch channels in smaller batches. The OpenChannelListQuery
and GroupChannelListQuery
instances provide a limit
parameter that allows you to specify the number of channels to retrieve in each API call.
Here’s an example of how you can fetch a channel list with a larger limit:
const openChannelQuery = sb.OpenChannel.createOpenChannelListQuery();
openChannelQuery.limit = 100; // Set the limit to the desired value
const openChannels = await openChannelQuery.next();
const groupChannelQuery = sb.GroupChannel.createMyGroupChannelListQuery();
groupChannelQuery.limit = 100; // Set the limit to the desired value
const groupChannels = await groupChannelQuery.next();
You can then use the next()
method of the query instances to fetch the next batch of channels. Repeat this process until you have fetched all the channels.
By using pagination, you can efficiently fetch a large number of users and channels without impacting the performance of your application.
Let me know if this helps in clarifying a few things here.