Hello, I’m using “sendbird-uikit”: “2.4.3” in React, and I’m encountering a strange issue with the ChannelList component. For some reason, when I include the includeEmpty: true option, it’s re-rendering the ChannelList every time I select a channel, which effectively means I can’t select a channel. Every time it re-renders I get sent back to the first channel.
However, if I remove the queries prop, it works just fine. Any ideas?
Welcome to the Sendbird Community. Could you provide a quick video showcasing what you’re seeing? I’ll try to recreate the behavior on my side but would be great to ensure we’re both on the same page in regards to what you’re seeing.
My apologies that this took so long to get back to you. If we take a look at the example code in the documents, we actually suggest passing in custom queries like such:
// queries.channelListQuery & queries.applicationUserListQuery
export const CustomQueryExample = () => {
// if channelListQuery object changes, ChannelList rerenders, so its better to keep them in state/memoized
const [queries] = useState({
channelListQuery: {
includeEmpty: true,
order: 'latest_last_message',
},
applicationUserListQuery: {
limit: 30,
userIdsFilter: ['katherine', 'cindy'],
},
});
return (
<Sendbird appId={appId} userId={userId}>
<ChannelList queries={queries} />
</Sendbird>
);
};
This is such a footgun, I think it should be considered a bug in the UIKit library and should get fixed. This happened to me, pretty much exactly as it happened to Henry. Using the components in this way, there seems to be no way to get empty channels without this React hack.