I’m trying to fetch non-empty group channels by setting the includeEmpty option to false.
The channels that never had messages did successfully get excluded.
But I noticed if I go to a channel that has some messages and delete all the messages, making it “empty”, that channel will still be returned in the list.
Not sure if it is intended. And if it is, how does SendBird determine whether a channel is really “empty”?
Another question:
What’s the better way to do pagination and why? GroupChannelListQuery or GroupChannelCollection?
I’ve tried both and both works.
I believe that the check is based on lastMessage. Let me run a check to see if you delete all messages if channel.lastMessage is also null or if that reference is missed when deleting.
I believe both will work. Collection is in reference to the SyncManager. You can read more about it here:
Local caching operates on the groupChannelCollection and messageCollection classes, which are used to build a channel list and a chat view, respectively.
Hi, is there any updates regarding the investigation on empty channels?
I did a comparison between two empty channels (one was returned even when includeEmpty is set to false, and another one correctly gets excluded). Both channels has their lastMessages set to null, I couldn’t really see what makes them behave differently…
Could you please help finding out the reason please?
Have you tested this on our sample app? Your query does look correct.
As a follow up question. Do you even want to still use that channel that had all messages deleted? Or would you ideally like it to be gone? If so you could mark that channel as hidden.
Actually, I’d just like to understand if what I’m encountering (empty channels being returned after all messages deleted) is an intended behaviour or an unintended bug.
If it’s intended, meaning includeEmpty does not determine whether the channel is “empty” based on the lastMessage property, since it’s null in both cases (originally empty channel and manually made empty channel).
Really just wanted to understand whether it’s intended and how the includeEmpty param works. I know how I could handle it if it’s intended.
I would say it doesnt seem like intended behavior. I would have to think there might be something wrong with the given channel. If you want to dm me the channel I can take a look further. Based on my tests with the sample app I was not able to reproduce the issue.
See the channel returned with no messages and no last_message
The docs say “Empty channels are channels that have been created but contain no messages.” not “but never contained messages” so I think this behavior is incorrect.