Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset channel list in calls to ChannelService.init()? #429

Open
nvahalik opened this issue May 11, 2023 · 4 comments
Open

Reset channel list in calls to ChannelService.init()? #429

nvahalik opened this issue May 11, 2023 · 4 comments

Comments

@nvahalik
Copy link

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.

@szuperaz
Copy link
Contributor

szuperaz commented May 12, 2023

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.

@duartejonathan
Copy link

Hello, do we have any news about this issue? 😁

@szuperaz
Copy link
Contributor

szuperaz commented Aug 8, 2023

I will try to get this done by the end of August, but I might not be able to do so.

@szuperaz
Copy link
Contributor

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 init with shouldSetActiveChannel option set to false
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants