Reset channel list in calls to ChannelService.init()?
Hello!
We have a weird issue that seems to relate to the various calls of init() and reset() on the ChannelService.
In short, we have a configuration service that is responsible for setting the standard "filter list" that gets passed to init(). We call reset() and then init(). The issue is that sometimes due to a configuration change on the user, the filters will update. If we are on a user's chat page, it will always deselect the active chat, which can cause chats to simply disappear.
IMO, it would be a better overall DX if the channel listing was always reset when calling init(). As it stands, you either must always call reset(), which will deselect the chat, even if you don't want it to, or you will get duplicate records in the channels$ observable.
Hi!
Your points make sense to me:
-
init()should clean the old channel list -
init()shouldn't deselect the previous active channel if the channel is present in the new channel list
I've added this to the backlog, you'll be notified through this GH issue when this is resolved.
Hello, do we have any news about this issue? 😁
I will try to get this done by the end of August, but I might not be able to do so.
An update on this: unfortunately, this won't be part of our August release, no ETA for now.
As a workaround, you can do this when you want to change the filters:
- Call
initwithshouldSetActiveChanneloption set tofalse - Once init is done, and the previous active channel is still in the list, you can manually select it again with
channelService.setAsActiveChannel
This doesn't solve the problem completely, as the active channel will change like this: <channel> -> undefined -> <channel>, so it'll still be undefined for a short amount of time.